MediaWiki master
MediaWiki\ResourceLoader\FilePath Class Reference

A path to a bundled file (such as JavaScript or CSS), along with a remote and local base path. More...

Public Member Functions

 __construct (string $path, ?string $localBasePath=null, ?string $remoteBasePath=null)
 
 getLocalBasePath ()
 
 getLocalPath ()
 
 getPath ()
 
 getRemoteBasePath ()
 
 getRemotePath ()
 
 initBasePaths (string $localBasePath, string $remoteBasePath)
 Set the base path if it has not already been set.
 

Protected Attributes

string string null $localBasePath
 Local base path.
 
string string $path
 Path to the file.
 
string string null $remoteBasePath
 Remote base path.
 

Detailed Description

A path to a bundled file (such as JavaScript or CSS), along with a remote and local base path.

This is for use with FileModule. Base path may be null, which indicates that the path is expanded relative to the corresponding base path of the FileModule object instead.

Since
1.17

Definition at line 34 of file FilePath.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\ResourceLoader\FilePath::__construct ( string $path,
?string $localBasePath = null,
?string $remoteBasePath = null )
Parameters
string$pathRelative path to the file, no leading slash.
string | null$localBasePathBase path to prepend when generating a local path.
string | null$remoteBasePathBase path to prepend when generating a remote path. Should not have a trailing slash unless at web document root.

Definition at line 50 of file FilePath.php.

References MediaWiki\ResourceLoader\FilePath\$localBasePath, MediaWiki\ResourceLoader\FilePath\$path, and MediaWiki\ResourceLoader\FilePath\$remoteBasePath.

Member Function Documentation

◆ getLocalBasePath()

MediaWiki\ResourceLoader\FilePath::getLocalBasePath ( )
Returns
string|null

Definition at line 86 of file FilePath.php.

◆ getLocalPath()

MediaWiki\ResourceLoader\FilePath::getLocalPath ( )
Returns
string
Exceptions
RuntimeExceptionIf the base path was not provided. You must either provide the base path in the constructor, or use getPath() instead and add the base path from a FileModule.

Definition at line 61 of file FilePath.php.

Referenced by MediaWiki\ResourceLoader\CodexModule\processStyle().

◆ getPath()

MediaWiki\ResourceLoader\FilePath::getPath ( )
Returns
string

Definition at line 96 of file FilePath.php.

◆ getRemoteBasePath()

MediaWiki\ResourceLoader\FilePath::getRemoteBasePath ( )
Returns
string|null

Definition at line 91 of file FilePath.php.

◆ getRemotePath()

MediaWiki\ResourceLoader\FilePath::getRemotePath ( )
Returns
string
Exceptions
RuntimeExceptionIf the base path was not provided. You must either provide the base path in the constructor, or use getPath() instead and add the base path from a FileModule.

Definition at line 73 of file FilePath.php.

◆ initBasePaths()

MediaWiki\ResourceLoader\FilePath::initBasePaths ( string $localBasePath,
string $remoteBasePath )

Set the base path if it has not already been set.

Parameters
string$localBasePath
string$remoteBasePath

Definition at line 106 of file FilePath.php.

Member Data Documentation

◆ $localBasePath

string string null MediaWiki\ResourceLoader\FilePath::$localBasePath
protected

Local base path.

Definition at line 36 of file FilePath.php.

Referenced by MediaWiki\ResourceLoader\FilePath\__construct().

◆ $path

string string MediaWiki\ResourceLoader\FilePath::$path
protected

Path to the file.

Definition at line 42 of file FilePath.php.

Referenced by MediaWiki\ResourceLoader\FilePath\__construct().

◆ $remoteBasePath

string string null MediaWiki\ResourceLoader\FilePath::$remoteBasePath
protected

Remote base path.

Definition at line 39 of file FilePath.php.

Referenced by MediaWiki\ResourceLoader\FilePath\__construct().


The documentation for this class was generated from the following file: