Exemple #1
0
 /**
  * @param mixed $instance
  * @return mixed Same instance always returned
  */
 public function loadInstance($instance)
 {
     $reflection = new \ReflectionClass($instance);
     while ($reflection) {
         if ($this->isAutoloadClass($reflection)) {
             $this->propertyConnector->connect($reflection, $instance);
             $this->methodConnector->connect($reflection, $instance);
         }
         $reflection = $reflection->getParentClass();
     }
     return $instance;
 }
 /**
  * @param PropertyConnector $connector
  * @param string $type
  * @return mixed
  */
 private function invokeConnect(PropertyConnector $connector, $type)
 {
     $instance = new $type();
     $connector->connect(new \ReflectionClass($type), $instance);
     return $instance;
 }