Path
    
            
            in package
            
        
    
    
    
        
            A class that serves as a path resolver for different paths/URLs of the app.
Example:
// NOTE: all methods that have "resolve" as prefix
// can also be called without the resolve prefix
// Path::resolve*() -> Path:*() like Path::resolveUrl() -> Path::url()
// get an absolute path from app root
$path = Path::resolve('some/path');
// get a public URL from app root
$url = Path::resolveUrl('some/route');
// get a relative path from theme root
$path = Path::resolveFromTheme('some/file.ext');
// get a public URL from theme root
$url = Path::resolveUrlFromTheme('some/file.ext');
// get a relative path from theme assets root
$path = Path::resolveFromAssets('some/file.ext');
// get a public URL from theme assets root
$url = Path::resolveUrlFromAssets('some/file.ext');
Tags
Table of Contents
- __call() : mixed
- Allows static methods handled by `self::__callStatic()` to be accessible via object operator `->`.
- __callStatic() : mixed
- Aliases `self::resolve*()` with a function of the same name without the "resolve" prefix.
- current() : string|bool
- Returns the current path, or compares it with the passed parameter. Note that the path does not contain the query string.
- currentUrl() : string|bool
- Returns the current URL, or compares it with the passed parameter.
- fromAssets() :
- fromTheme() :
- normalize() : string
- Returns a normalized path based on OS.
- resolve() : string
- Resolves the passed path to the app root path and returns it.
- resolveFromAssets() : string
- Resolves the passed path to the assets directory and returns it.
- resolveFromTheme() : string
- Resolves the passed path to the theme root path and returns it.
- resolveUrl() : string
- Resolves the passed path to the base URL (starting from app root) and returns it.
- resolveUrlFromAssets() : string
- Resolves the passed path to the base URL (starting from active theme assets root) and returns it.
- resolveUrlFromTheme() : string
- Resolves the passed path to the base URL (starting from active theme root) and returns it.
- url() :
- urlFromAssets() :
- urlFromTheme() :
Methods
__call()
Allows static methods handled by `self::__callStatic()` to be accessible via object operator `->`.
    public
                __call(string $method, array<string|int, mixed> $arguments) : mixed
    
        Parameters
- $method : string
- $arguments : array<string|int, mixed>
Return values
mixed —__callStatic()
Aliases `self::resolve*()` with a function of the same name without the "resolve" prefix.
    public
            static    __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
    
        Parameters
- $method : string
- $arguments : array<string|int, mixed>
Return values
mixed —current()
Returns the current path, or compares it with the passed parameter. Note that the path does not contain the query string.
    public
            static    current([string|null $compareTo = null ]) : string|bool
    
        Parameters
- $compareTo : string|null = null
- 
                    [optional] Some path on the server. 
Return values
string|bool —If null is passed, the current path as string. Otherwise the result of comparing the current path with the passed parameter as boolean.
currentUrl()
Returns the current URL, or compares it with the passed parameter.
    public
            static    currentUrl([string|null $compareTo = null ]) : string|bool
    
        Parameters
- $compareTo : string|null = null
- 
                    [optional] Some URL on the server. 
Return values
string|bool —If null is passed, the current URL as string. Otherwise the result of comparing the current URL with the passed parameter as boolean.
fromAssets()
    public
            static    fromAssets(string $path = '/', string $prefix = '') : 
    
        Parameters
- $path = '/' : string
- $prefix = '' : string
Return values
—fromTheme()
    public
            static    fromTheme(string $path = '/', string $prefix = '') : 
    
        Parameters
- $path = '/' : string
- $prefix = '' : string
Return values
—normalize()
Returns a normalized path based on OS.
    public
            static    normalize(string $directory, string $filename[, string $extension = '' ]) : string
    
        Parameters
- $directory : string
- $filename : string
- $extension : string = ''
Return values
string —resolve()
Resolves the passed path to the app root path and returns it.
    public
            static    resolve([string $path = '/' ]) : string
    
        Parameters
- $path : string = '/'
Return values
string —An absolute path on the server starting from app root.
resolveFromAssets()
Resolves the passed path to the assets directory and returns it.
    public
            static    resolveFromAssets([string $path = '/' ][, string $prefix = '' ]) : string
    
        Parameters
- $path : string = '/'
- $prefix : string = ''
Return values
string —A relative path starting from app root to the root of the assets directory of the active theme directory.
resolveFromTheme()
Resolves the passed path to the theme root path and returns it.
    public
            static    resolveFromTheme([string $path = '/' ][, string $prefix = '' ]) : string
    
        Parameters
- $path : string = '/'
- $prefix : string = ''
Return values
string —A relative path starting from app root to the root of the active theme directory.
resolveUrl()
Resolves the passed path to the base URL (starting from app root) and returns it.
    public
            static    resolveUrl([string $path = '/' ]) : string
    
        Parameters
- $path : string = '/'
Return values
string —An absolute path on the server (public URL) starting from app root.
resolveUrlFromAssets()
Resolves the passed path to the base URL (starting from active theme assets root) and returns it.
    public
            static    resolveUrlFromAssets([string $path = '/' ]) : string
    
        Parameters
- $path : string = '/'
Return values
string —An absolute path on the server (public URL) starting from active theme root.
resolveUrlFromTheme()
Resolves the passed path to the base URL (starting from active theme root) and returns it.
    public
            static    resolveUrlFromTheme([string $path = '/' ]) : string
    
        Parameters
- $path : string = '/'
Return values
string —An absolute path on the server (public URL) starting from active theme root.
url()
    public
            static    url(string $path = '/') : 
    
        Parameters
- $path = '/' : string
Return values
—urlFromAssets()
    public
            static    urlFromAssets(string $path = '/') : 
    
        Parameters
- $path = '/' : string
Return values
—urlFromTheme()
    public
            static    urlFromTheme(string $path = '/') : 
    
        Parameters
- $path = '/' : string