1 | <?php |
||
15 | class Resource |
||
16 | { |
||
17 | /** @var string Full path to project web root directory */ |
||
18 | public static $webRoot; |
||
19 | |||
20 | /** @var string Full path to project root directory */ |
||
21 | public static $projectRoot; |
||
22 | |||
23 | /** |
||
24 | * Build relative path to static resource relatively to web root path. |
||
25 | * |
||
26 | * @param string $relativePath Relative path to static resource |
||
27 | * @param string $parentPath Path to parent entity |
||
28 | * |
||
29 | * @return string Validated relative path to static resource relatively to web root path |
||
30 | * @throws ResourceNotFound |
||
31 | */ |
||
32 | public static function getWebRelativePath($relativePath, $parentPath = '') |
||
36 | |||
37 | /** |
||
38 | * Build correct relative path to static resource using relative path and parent path. |
||
39 | * |
||
40 | * @param string $relativePath Relative path to static resource |
||
41 | * @param string $parentPath Path to parent entity |
||
42 | * @param string $rootPath Root path for relative path building |
||
43 | * |
||
44 | * @return string Validated relative path to static resource |
||
45 | * @throws ResourceNotFound |
||
46 | */ |
||
47 | public static function getRelativePath($relativePath, $parentPath = '', $rootPath = '') |
||
68 | |||
69 | /** |
||
70 | * Build relative path to static resource relatively to project root path. |
||
71 | * |
||
72 | * @param string $relativePath Relative path to static resource |
||
73 | * @param string $parentPath Path to parent entity |
||
74 | * |
||
75 | * @return string Validated relative path to static resource relatively to project root path |
||
76 | * @throws ResourceNotFound |
||
77 | */ |
||
78 | public static function getProjectRelativePath($relativePath, $parentPath = '') |
||
82 | } |
||
83 |