src/main/php/routing/Interceptors.php
private function executePreInterceptor($preInterceptor, Request $request, Response $response)
    {
        if (is_callable($preInterceptor)) {
            return $preInterceptor($request, $response);
        }

        if ($preInterceptor instanceof PreInterceptor) {
            return $preInterceptor->preProcess($request, $response);
        }

        $instance = $this->injector->getInstance($preInterceptor);
        if (!($instance instanceof PreInterceptor)) {
            $response->write(
                    $response->internalServerError(
                            'Configured pre interceptor ' . $preInterceptor
                            . ' is not an instance of ' . PreInterceptor::class
                    )
            );
            return false;
        }

        return $instance->preProcess($request, $response);
    }
private function executePreInterceptor($preInterceptor, Request $request, Response $response)
    {
        if (is_callable($preInterceptor)) {
            return $preInterceptor($request, $response);
        }

        if ($preInterceptor instanceof PreInterceptor) {
            return $preInterceptor->preProcess($request, $response);
        }

        $instance = $this->injector->getInstance($preInterceptor);
        if (!($instance instanceof PreInterceptor)) {
            $response->write(
                    $response->internalServerError(
                            'Configured pre interceptor ' . $preInterceptor
                            . ' is not an instance of ' . PreInterceptor::class
                    )
            );
            return false;
        }

        return $instance->preProcess($request, $response);
    }
private function executePreInterceptor ( $ preInterceptor , Request $ request , Response $ response ) { if ( is_callable ( $ preInterceptor ) ) { return $ preInterceptor ( $ request , $ response ) ; } if ( $ preInterceptor instanceof PreInterceptor ) { return $ preInterceptor -> preProcess ( $ request , $ response ) ; } $ instance = $ this -> injector -> getInstance ( $ preInterceptor ) ; if ( ! ( $ instance instanceof PreInterceptor ) ) { $ response -> write ( $ response -> internalServerError ( 'Configured pre interceptor ' . $ preInterceptor . ' is not an instance of ' . PreInterceptor :: class ) ) ; return false ; } return $ instance -> preProcess ( $ request , $ response ) ; }
executes pre interceptor

@param   mixed                      $preInterceptor
@param   \stubbles\webapp\Request   $request         current request
@param   \stubbles\webapp\Response  $response        response to send
@return  bool|null
executes pre interceptor