src/Route.php
private static function splitPath(string $path): array
    {
        if ($path === '') {
            return [];
        }

        $result = explode('/', $path);

        foreach ($result as $pathPart) {
            if ($pathPart === '') {
                throw new InvalidRoutePathException('Path "' . $path . '" contains empty part.');
            }
            if (preg_match('/[^a-zA-Z0-9._-]/', $pathPart, $matches)) {
                throw new InvalidRoutePathException('Path "' . $path . '" contains invalid character "' . $matches[0] . '".');
            }
        }

        return $result;
    }
private static function splitPath(string $path): array
    {
        if ($path === '') {
            return [];
        }

        $result = explode('/', $path);

        foreach ($result as $pathPart) {
            if ($pathPart === '') {
                throw new InvalidRoutePathException('Path "' . $path . '" contains empty part.');
            }
            if (preg_match('/[^a-zA-Z0-9._-]/', $pathPart, $matches)) {
                throw new InvalidRoutePathException('Path "' . $path . '" contains invalid character "' . $matches[0] . '".');
            }
        }

        return $result;
    }
private static function splitPath ( string $ path ) : array { if ( $ path === '' ) { return [ ] ; } $ result = explode ( '/' , $ path ) ; foreach ( $ result as $ pathPart ) { if ( $ pathPart === '' ) { throw new InvalidRoutePathException ( 'Path "' . $ path . '" contains empty part.' ) ; } if ( preg_match ( '/[^a-zA-Z0-9._-]/' , $ pathPart , $ matches ) ) { throw new InvalidRoutePathException ( 'Path "' . $ path . '" contains invalid character "' . $ matches [ 0 ] . '".' ) ; } } return $ result ; }
Splits a path in parts.

@param string $path The path.

@throws InvalidRoutePathException If the path is invalid.

@return string[] The path as parts.
Splits a path in parts .