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