/**
  * Invokes the callbacks from `$this->after`, ignoring any returned values.
  */
 private function invokeAfter(array $namedParams, array $classParams)
 {
     $invoker = new Invoker();
     foreach ($this->after as $function) {
         $invoker->invoke($function, $namedParams, $classParams);
     }
 }
Beispiel #2
0
 /**
  * Calls the first callback which matches the given exception (is of the
  * same class or parent).
  *
  * @param  Exception $ex The exception to handle.
  * @return Response|null Returns a response returned by the handler, or null
  * if no callbacks matched the exception.
  */
 public function handle(\Exception $ex, Request $request)
 {
     foreach ($this->callbacks as $exClass => $callback) {
         if ($ex instanceof $exClass) {
             $invoker = new Invoker();
             return $invoker->invoke($callback, [], [$ex, $request]);
         }
     }
 }
Beispiel #3
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage $classParams contains multiple objects of the
  *     same class [Symfony\Component\HttpFoundation\Request].
  */
 public function testMultipleClassParamOfSameClass()
 {
     $function = function () {
     };
     $invoker = new Invoker();
     $invoker->invoke($function, [], [new Request(), new Request()]);
 }