示例#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;
         }
     }
 }
示例#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));
 }
示例#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);
 }
示例#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;
 }