Пример #1
0
 public function enhance($obj)
 {
     // Interface enhances
     if (valid_obj($obj, 'Psr\\Log\\LoggerAwareInterface')) {
         $obj->setLogger($this->getLogger(get_class($obj)));
         // Setting the logger according to the class name
     }
     if (valid_obj($obj, 'Clips\\Interfaces\\ClipsAware')) {
         $obj->setClips($this->clips);
     }
     if (valid_obj($obj, 'Clips\\Interfaces\\ToolAware')) {
         $obj->setTool($this);
     }
     // Enhance the object using the annotation
     $re = new \Addendum\ReflectionAnnotatedClass($obj);
     foreach ($re->getAllAnnotations() as $a) {
         $this->annotationEnhance($a, $obj);
     }
     // Process initialize
     if (is_subclass_of($obj, 'CLips\\Interfaces\\Initializable')) {
         // Call the init function
         $obj->init();
     }
     return $obj;
 }