private function checkPaths($path, array $paths)
    {
        $reserved = [
            '?' => '\?',
            '.' => '\.',
            '*' => '.*',
            '+' => '\+',
            '(' => '\(',
            ')' => '\)',
            '[' => '\[',
            ']' => '\]',
        ];
        $errorHandler = new ErrorHandler();
        set_error_handler([$errorHandler, 'callback'], E_NOTICE | E_WARNING);
        foreach ($paths as $rule) {
            $escaped = str_replace(array_keys($reserved), array_values($reserved), $rule);
            if (preg_match('#^' . $escaped . '#', $path) === 1) {
                restore_error_handler();
                return mb_strlen($rule);
            }
        }
        restore_error_handler();
        return false;
    }
private function checkPaths($path, array $paths)
    {
        $reserved = [
            '?' => '\?',
            '.' => '\.',
            '*' => '.*',
            '+' => '\+',
            '(' => '\(',
            ')' => '\)',
            '[' => '\[',
            ']' => '\]',
        ];
        $errorHandler = new ErrorHandler();
        set_error_handler([$errorHandler, 'callback'], E_NOTICE | E_WARNING);
        foreach ($paths as $rule) {
            $escaped = str_replace(array_keys($reserved), array_values($reserved), $rule);
            if (preg_match('#^' . $escaped . '#', $path) === 1) {
                restore_error_handler();
                return mb_strlen($rule);
            }
        }
        restore_error_handler();
        return false;
    }
private function checkPaths ( $ path , array $ paths ) { $ reserved = [ '?' => '\?' , '.' => '\.' , '*' => '.*' , '+' => '\+' , '(' => '\(' , ')' => '\)' , '[' => '\[' , ']' => '\]' , ] ; $ errorHandler = new ErrorHandler ( ) ; set_error_handler ( [ $ errorHandler , 'callback' ] , E_NOTICE | E_WARNING ) ; foreach ( $ paths as $ rule ) { $ escaped = str_replace ( array_keys ( $ reserved ) , array_values ( $ reserved ) , $ rule ) ; if ( preg_match ( '#^' . $ escaped . '#' , $ path ) === 1 ) { restore_error_handler ( ) ; return mb_strlen ( $ rule ) ; } } restore_error_handler ( ) ; return false ; }
Check path rule

@param string $path
@param string[] $paths
@return int|false
Check path rule