src/main/php/routing/Routing.php
public function preIntercept($preInterceptor, string $path = null, string $requestMethod = null): RoutingConfigurator
    {
        if (!is_callable($preInterceptor) && !($preInterceptor instanceof PreInterceptor) && !class_exists((string) $preInterceptor)) {
            throw new \InvalidArgumentException(
                    'Given pre interceptor must be a callable, an instance of '
                    . PreInterceptor::class
                    . ' or a class name of an existing pre interceptor class'
            );
        }

        $this->preInterceptors[] = [
                'interceptor'   => $preInterceptor,
                'requestMethod' => $requestMethod,
                'path'          => $path
        ];
        return $this;
    }
public function preIntercept($preInterceptor, string $path = null, string $requestMethod = null): RoutingConfigurator
    {
        if (!is_callable($preInterceptor) && !($preInterceptor instanceof PreInterceptor) && !class_exists((string) $preInterceptor)) {
            throw new \InvalidArgumentException(
                    'Given pre interceptor must be a callable, an instance of '
                    . PreInterceptor::class
                    . ' or a class name of an existing pre interceptor class'
            );
        }

        $this->preInterceptors[] = [
                'interceptor'   => $preInterceptor,
                'requestMethod' => $requestMethod,
                'path'          => $path
        ];
        return $this;
    }
public function preIntercept ( $ preInterceptor , string $ path = null , string $ requestMethod = null ) : RoutingConfigurator { if ( ! is_callable ( $ preInterceptor ) && ! ( $ preInterceptor instanceof PreInterceptor ) && ! class_exists ( ( string ) $ preInterceptor ) ) { throw new \ InvalidArgumentException ( 'Given pre interceptor must be a callable, an instance of ' . PreInterceptor :: class . ' or a class name of an existing pre interceptor class' ) ; } $ this -> preInterceptors [ ] = [ 'interceptor' => $ preInterceptor , 'requestMethod' => $ requestMethod , 'path' => $ path ] ; return $ this ; }
pre intercept with given class or callable on all requests

@param   string|callable|\stubbles\webapp\interceptor\PreInterceptor  $preInterceptor  pre interceptor to add
@param   string                                                       $path            optional  path for which pre interceptor should be executed
@param   string                                                       $requestMethod   request method for which interceptor should be executed
@return  \stubbles\webapp\RoutingConfigurator
@throws  \InvalidArgumentException
pre intercept with given class or callable on all requests