1 | <?php |
||
15 | trait AssetHandlerTrait |
||
16 | { |
||
17 | /** @var AssetManager */ |
||
18 | protected $assetManager; |
||
19 | |||
20 | /** @var ContentItem */ |
||
21 | protected $contentItem; |
||
22 | |||
23 | /** |
||
24 | * Get a File object from a local path relative to the ContentItem. |
||
25 | * |
||
26 | * @param string $localPath |
||
27 | * |
||
28 | * @return File |
||
29 | */ |
||
30 | private function getFileFromPath($localPath) |
||
38 | |||
39 | /** |
||
40 | * Get the permalink this file would belong at. |
||
41 | * |
||
42 | * This is taken from the ContentItem's target path and puts the asset at the same location as a sibling. |
||
43 | * |
||
44 | * @param File $file |
||
45 | * |
||
46 | * @return string |
||
|
|||
47 | */ |
||
48 | private function getPermalinkFromFile(File $file) |
||
54 | |||
55 | /** |
||
56 | * Check if a given string is a valid URL. |
||
57 | * |
||
58 | * @param string $url |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | private function isValidURL($url) |
||
66 | |||
67 | /** |
||
68 | * Given a URL to a local path, register this function with the AssetManager so it can be available at compile time. |
||
69 | * |
||
70 | * @since 0.2.1 |
||
71 | * |
||
72 | * @param string $path |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | protected function registerAsset($path) |
||
88 | } |
||
89 |
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.