@@ -75,28 +75,29 @@ public function prePersist(LifecycleEventArgs $args)
7575 break ;
7676 }
7777
78- $ string = $ this ->generateString ($ property ->name , $ annotation , $ object );
78+ $ string = $ this ->generateString ($ property ->name , $ annotation , $ entity );
7979 $ property ->setValue ($ entity , $ string );
8080 }
8181 }
8282 }
8383 }
8484
8585 /**
86- * @param $property
86+ * @param string $property
8787 * @param GeneratorAnnotation $annotation
88- * @param \ReflectionObject $object
88+ * @param object $entity
89+ *
8990 * @return string
9091 */
91- private function generateString ($ property , GeneratorAnnotation $ annotation , $ object )
92+ private function generateString ($ property , GeneratorAnnotation $ annotation , $ entity )
9293 {
9394 /** @var GeneratorInterface|ConfigurableGeneratorInterface $generator */
9495 $ generator = $ this ->getRegistry ()->get ($ annotation ->generator );
9596
9697 $ generator ->setLength ($ annotation ->length );
9798
9899 if (!empty ($ annotation ->callbacks )){
99- $ this ->performCallbacks ($ generator , $ annotation , $ object );
100+ $ this ->performCallbacks ($ generator , $ annotation , $ entity );
100101 }
101102
102103 if ($ generator instanceof ConfigurableGeneratorInterface){
@@ -110,7 +111,7 @@ private function generateString($property, GeneratorAnnotation $annotation, $obj
110111 }
111112
112113 if ($ this ->repo ->findOneBy ([$ property => $ str ])) {
113- return $ this ->generateString ($ property , $ annotation , $ object );
114+ return $ this ->generateString ($ property , $ annotation , $ entity );
114115 } else {
115116 return $ str ;
116117 }
@@ -133,25 +134,26 @@ public function configureGenerator(ConfigurableGeneratorInterface $generator, $o
133134 }
134135
135136 /**
136- * @param GeneratorInterface $generator
137+ * @param GeneratorInterface $generator
137138 * @param GeneratorAnnotation $annotation
138- * @param \ReflectionObject $object
139+ * @param object $object
139140 */
140141 public function performCallbacks (GeneratorInterface $ generator , GeneratorAnnotation $ annotation , $ object )
141142 {
142143 foreach ($ annotation ->callbacks as $ callback => $ value ){
143- if ($ this ->isMethod ($ generator , $ callback )){
144-
145- if ($ this ->isMethod ($ object , $ value )){
144+ if ($ this ->isMethod ($ generator , $ callback )) {
145+ if ($ this ->isMethod ($ object , $ value )) {
146146 $ value = $ object ->$ value ();
147147 }
148+
148149 $ generator ->$ callback ($ value );
149- }
150- else {
151- throw new \InvalidArgumentException (sprintf (
152- 'Callback "%s" does not exist in class "%s" ' ,
153- $ callback ,
154- get_class ($ generator ))
150+ } else {
151+ throw new \InvalidArgumentException (
152+ sprintf (
153+ 'Callback "%s" does not exist in class "%s" ' ,
154+ $ callback ,
155+ get_class ($ generator )
156+ )
155157 );
156158 }
157159 }
0 commit comments