MediaWiki
REL1_39
FilePath.php
Go to the documentation of this file.
1
<?php
21
namespace
MediaWiki\ResourceLoader
;
22
23
use RuntimeException;
24
34
class
FilePath
{
36
protected
$localBasePath
;
37
39
protected
$remoteBasePath
;
40
42
protected
$path
;
43
50
public
function
__construct
(
$path
,
$localBasePath
=
null
,
$remoteBasePath
=
null
) {
51
$this->path =
$path
;
52
$this->localBasePath =
$localBasePath
;
53
$this->remoteBasePath =
$remoteBasePath
;
54
}
55
61
public
function
getLocalPath
() {
62
if
( $this->localBasePath ===
null
) {
63
throw
new
RuntimeException(
'Base path was not provided'
);
64
}
65
return
"{$this->localBasePath}/{$this->path}"
;
66
}
67
73
public
function
getRemotePath
() {
74
if
( $this->remoteBasePath ===
null
) {
75
throw
new
RuntimeException(
'Base path was not provided'
);
76
}
77
if
( $this->remoteBasePath ===
'/'
) {
78
// In document root
79
// Don't insert another slash (T284391).
80
return
$this->remoteBasePath .
$this->path
;
81
}
82
return
"{$this->remoteBasePath}/{$this->path}"
;
83
}
84
86
public
function
getLocalBasePath
() {
87
return
$this->localBasePath
;
88
}
89
91
public
function
getRemoteBasePath
() {
92
return
$this->remoteBasePath
;
93
}
94
96
public
function
getPath
() {
97
return
$this->path
;
98
}
99
}
100
102
class_alias( FilePath::class,
'ResourceLoaderFilePath'
);
MediaWiki\ResourceLoader\FilePath
A path to a bundled file (such as JavaScript or CSS), along with a remote and local base path.
Definition
FilePath.php:34
MediaWiki\ResourceLoader\FilePath\__construct
__construct( $path, $localBasePath=null, $remoteBasePath=null)
Definition
FilePath.php:50
MediaWiki\ResourceLoader\FilePath\$remoteBasePath
string null $remoteBasePath
Remote base path.
Definition
FilePath.php:39
MediaWiki\ResourceLoader\FilePath\$localBasePath
string null $localBasePath
Local base path.
Definition
FilePath.php:36
MediaWiki\ResourceLoader\FilePath\getLocalBasePath
getLocalBasePath()
Definition
FilePath.php:86
MediaWiki\ResourceLoader\FilePath\getRemotePath
getRemotePath()
Definition
FilePath.php:73
MediaWiki\ResourceLoader\FilePath\$path
string $path
Path to the file.
Definition
FilePath.php:42
MediaWiki\ResourceLoader\FilePath\getLocalPath
getLocalPath()
Definition
FilePath.php:61
MediaWiki\ResourceLoader\FilePath\getRemoteBasePath
getRemoteBasePath()
Definition
FilePath.php:91
MediaWiki\ResourceLoader\FilePath\getPath
getPath()
Definition
FilePath.php:96
MediaWiki\ResourceLoader
Definition
CircularDependencyError.php:21
includes
ResourceLoader
FilePath.php
Generated on Tue Oct 8 2024 07:23:40 for MediaWiki by
1.10.0