Esempio n. 1
0
 private function doDispatch($listeners, IEvent $event)
 {
     foreach ($listeners as $listener) {
         $this->invoker->invoke($listener, $event->getParameters(), array($event, $event->getSubject()));
         if ($event->isPropagationStopped()) {
             break;
         }
     }
 }
Esempio n. 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $arrayOpt = $input->getOptions();
     foreach ($arrayOpt as $optionName => $optionValue) {
         if (is_null($optionValue)) {
             unset($arrayOpt[$optionName]);
         }
     }
     $this->invoker->invoke($this->callable, $arrayOpt, array($input, $output));
 }
Esempio n. 3
0
 /**
  * This method should not be called directly
  * 
  * @param string $rule
  * @param array $contextParameters
  * @param string $context
  * @return boolean
  */
 public function verifyRule($rule, $contextParameters, $context)
 {
     list($ruleName, $ruleParameters) = $this->extractRuleParameters($rule);
     $ruleParameters = new ArrayObject($ruleParameters);
     $ruleObject = $this->getRule($ruleName, $context, $ruleParameters);
     return $this->invoker->invoke($ruleObject, $ruleParameters->getArrayCopy(), $contextParameters);
 }
Esempio n. 4
0
 /**
  * 
  * @param type $serviceName
  * @param type $methodName
  * @param Request $request
  * 
  * @return Response
  */
 public function execute($serviceName, $methodName, Request $request, Response $response = null)
 {
     $this->routing->setCurrentRequest($request);
     if (is_null($response)) {
         $response = new Response();
     }
     $this->eventDispatcher->dispatch('FrontController.preExecute', $this, compact('serviceName', 'methodName', 'response', 'request'));
     $parameters = array_merge($request->query->all(), $request->request->all());
     $service = $this->serviceContainer->getServiceByName($serviceName);
     try {
         $executionResult = $this->invoker->invoke(array($service, $methodName), $parameters, array($request, $response));
     } catch (Exception $e) {
         $executionResult = $this->frontControllerExceptionHandler->handleException($e, $request, $response);
     }
     $finalResponse = $this->completeResponse($executionResult, $request, $response);
     $finalResponse->prepare($request);
     $this->eventDispatcher->dispatch("Response.beforeSend", $finalResponse);
     return $finalResponse;
 }