1 | <?php |
||
24 | class FilesystemLocation implements LocationInterface |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Path that this location points to. |
||
29 | * |
||
30 | * @since 0.1.0 |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $path; |
||
35 | |||
36 | /** |
||
37 | * Extensions that this location can accept. |
||
38 | * |
||
39 | * @since 0.1.0 |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $extensions; |
||
44 | |||
45 | /** |
||
46 | * Instantiate a FilesystemLocation object. |
||
47 | * |
||
48 | * @since 0.1.0 |
||
49 | * |
||
50 | * @param string $path Path that this location points to. |
||
51 | * @param array $extensions Array of extensions that this location can accept. |
||
52 | */ |
||
53 | 20 | public function __construct($path, array $extensions = []) |
|
58 | |||
59 | /** |
||
60 | * Get the first URI that matches the given criteria. |
||
61 | * |
||
62 | * @since 0.1.0 |
||
63 | * |
||
64 | * @param array $criteria Criteria to match. |
||
65 | * |
||
66 | * @return string|false URI that matches the criteria or false if none found. |
||
|
|||
67 | */ |
||
68 | 20 | public function getURI(array $criteria) |
|
78 | |||
79 | /** |
||
80 | * Get all URIs that match the given criteria. |
||
81 | * |
||
82 | * @since 0.1.1 |
||
83 | * |
||
84 | * @param array $criteria Criteria to match. |
||
85 | * |
||
86 | * @return array URIs that match the criteria or empty array if none found. |
||
87 | */ |
||
88 | 3 | public function getURIs(array $criteria) |
|
100 | |||
101 | /** |
||
102 | * Try to transform the entry into possible URIs. |
||
103 | * |
||
104 | * @since 0.1.0 |
||
105 | * |
||
106 | * @param string $entry Entry to transform. |
||
107 | * @param bool $firstOnly Return the first result only. |
||
108 | * |
||
109 | * @return array|string|false If $firstOnly is true, returns a string with the URI of the view, or false if none |
||
110 | * found. |
||
111 | * If $firstOnly is false, returns an array with all matching URIs, or an empty array if |
||
112 | * none found. |
||
113 | */ |
||
114 | 20 | protected function transform($entry, $firstOnly = true) |
|
140 | } |
||
141 |
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.If the return type contains the type array, this check recommends the use of a more specific type like
String[]
orarray<String>
.