Beispiel #1
0
 /**
  * Finds and registers controllers.
  *
  * Override this method if your extension controllers do not follow the conventions:
  *
  *  - The controller folder is defined in the extensions config
  *  - The naming convention is 'HelloController.php'
  *
  * @param ControllerCollection $collection
  */
 public function registerControllers(ControllerCollection $collection)
 {
     if (isset($this->config['controllers'])) {
         $controllers = (array) $this->config['controllers'];
         foreach ($controllers as $controller) {
             foreach (glob($this->getPath() . '/' . ltrim($controller, '/')) as $file) {
                 $path = strtolower(sprintf('%s/%s', $this->getName(), basename($file, 'Controller.php')));
                 $name = '@' . $path;
                 $collection->add($file, compact('path', 'name'));
             }
         }
     }
 }