Exemple #1
0
 /**
  * Handles custom reactor options.
  *
  * @access  protected
  */
 protected function handleCustomOptions()
 {
     foreach ($this->options as $name => $option) {
         $input = $this->input->getArgument($name);
         if (!empty($input)) {
             $handler = $option['handler'];
             $this->container->call($handler, ['option' => $input]);
         }
     }
 }
 /**
  * Dispatch a controller action.
  *
  * @access  protected
  * @param   string     $controller  Controller
  */
 protected function dispatchController($controller)
 {
     list($controller, $method) = explode('::', $controller, 2);
     $controller = $this->container->get($controller);
     // Execute the before filter if we have one
     if (method_exists($controller, 'beforeFilter')) {
         $returnValue = $this->container->call([$controller, 'beforeFilter']);
     }
     if (empty($returnValue)) {
         // The before filter didn't return any data so we can set the
         // response body to whatever the route action returns
         $this->response->body($this->container->call([$controller, $method], $this->parameters));
         // Execute the after filter if we have one
         if (method_exists($controller, 'afterFilter')) {
             $this->container->call([$controller, 'afterFilter']);
         }
     } else {
         // The before filter returned data so we'll set the response body to whatever it returned
         // and tell the dispatcher to skip all after filters
         $this->response->body($returnValue);
         $this->skipAfterFilters = true;
     }
 }
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage mako\syringe\Container::resolveParameter(): Unable to resolve the [ $foo ] parameter of
  *
  * The entire exception message isn't included in the test because of some HHVM incompatibility that causes the test to fail
  */
 public function testCallMethodWithUnresolvableParameters()
 {
     $container = new Container();
     $container->call(function ($foo) {
     });
 }
 /**
  * Executes the command.
  *
  * @access  protected
  * @param   \mako\reactor\Command  $command    Command instance
  * @param   array                  $arguments  Command arguments
  */
 protected function execute(Command $command, array $arguments)
 {
     $this->container->call([$command, 'execute'], $arguments);
 }
 /**
  * Executes a class handler and returns the response.
  *
  * @access  protected
  * @param   \mako\event\EventHandlerInterface  $handler     Event handler
  * @param   array                              $parameters  Parameters
  * @return  mixed
  */
 protected function executeClassHandler(EventHandlerInterface $handler, array $parameters)
 {
     return $this->container->call([$handler, 'handle'], $parameters);
 }
Exemple #6
0
 /**
  * Executes a migration method.
  *
  * @access  protected
  * @param   string  $migration  Migration class
  * @param   string  $method     Migration method
  */
 protected function runMigration($migration, $method)
 {
     $this->container->call([$this->resolve($migration), $method]);
 }