name = $class; $this->ns = $namespace . (new \ReflectionClass($class))->getShortName(); $this->route = $route; $this->args = $args; } } /*! * create a service dedicated to the controller and mount the controller's routes * * @method register * @public * @param Pimple\Container $app */ public function register(Container $app) { if (!is_null($this->name)) { $class = $this->name; $args = $this->args; $app[$this->ns] = function() use ($class, $args) { return new $class(...$args); }; if (!is_null($this->route)) { $imp = class_implements($class); if (isset($imp['Silex\\Api\\ControllerProviderInterface'])) { $app->mount($this->route, $app[$this->ns]->connect($app)); } } } } }