示例#1
0
 private function loadComponent($component, $arguments, $path, $plugin = null)
 {
     $camelizedComponent = Ntentan::camelize($component);
     $componentName = "{$path}\\{$component}\\{$camelizedComponent}Component";
     if (file_exists(Ntentan::getClassFile($componentName))) {
         $key = Ntentan::camelizeAndLowerFirst($plugin . ($plugin == null ? $camelizedComponent : $camelizedComponent));
         $componentClass = new ReflectionClass($componentName);
         $componentInstance = $componentClass->newInstanceArgs($arguments);
         $componentInstance->filePath = Ntentan::getFilePath("lib/controllers/components/{$component}");
         $this->componentInstances[$key] = $componentInstance;
         $this->componentInstances[$key]->setController($this);
         $this->componentInstances[$key]->route = $this->route;
         $this->componentInstances[$key]->init();
         return $componentName;
     } else {
         return false;
     }
 }