1 | <?php |
||
14 | class Assets extends DB |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var \FFCMS\Mappers\Assets mapper for asset |
||
19 | */ |
||
20 | public $mapper; |
||
21 | |||
22 | /** |
||
23 | * initialize with array of params, 'db' and 'logger' can be injected |
||
24 | * |
||
25 | * @param null|\Log $logger |
||
26 | * @param null|\DB\SQL $db |
||
27 | */ |
||
28 | public function __construct(array $params = [], \Log $logger = null, \DB\SQL $db = null) |
||
34 | |||
35 | /** |
||
36 | * Get the associated asset mapper |
||
37 | * |
||
38 | * @return \FFCMS\Mappers\Assets |
||
39 | */ |
||
40 | public function &getMapper() |
||
44 | |||
45 | /** |
||
46 | * Return the URL path to the asset |
||
47 | * |
||
48 | * @param string $assetPath the path in assets, must prefix slash, no trailing slash |
||
49 | * @return string return the url path or false if not exists |
||
50 | */ |
||
51 | public function assetUrlPath($assetPath): string |
||
56 | |||
57 | /** |
||
58 | * Create if needed, and return the dir to the asset path |
||
59 | * |
||
60 | * @return string string $assetPath the path in assets |
||
61 | */ |
||
62 | public function assetDirPath($assetPath): string |
||
71 | |||
72 | /** |
||
73 | * Create if needed, and return the path to the asset file path |
||
74 | * |
||
75 | * @param string $dirPath dir for the $filename |
||
76 | * @param string $filename filename for asset |
||
77 | * @return string $path to the asset |
||
78 | */ |
||
79 | public function assetFilePath($dirPath, $filename): string |
||
83 | |||
84 | /** |
||
85 | * Return the URL path to the asset if exists or false |
||
86 | * |
||
87 | * @param string $dirPath dir for the $filename |
||
88 | * @return string $path to the asset |
||
89 | * @return bool true if the asset exists |
||
|
|||
90 | */ |
||
91 | public function assetExists($dirPath, $filename) |
||
95 | |||
96 | /** |
||
97 | * Return the URL path to the asset if exists or false |
||
98 | * |
||
99 | * @param string $dirPath dir for the $filename |
||
100 | * @param string $uuid the user uuid |
||
101 | * @return false|string return the url path or false if not exists |
||
102 | */ |
||
103 | public function assetUrl($dirPath, $filename) |
||
111 | } |
||
112 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.