1 | <?php namespace Myth\Bay; |
||
8 | class Bay { |
||
9 | |||
10 | /** |
||
11 | * Instance of our customized class loader. |
||
12 | * |
||
13 | * @var LibraryFinderInterface|null |
||
14 | */ |
||
15 | protected $finder = null; |
||
16 | |||
17 | /** |
||
18 | * Instance of our cache access library. |
||
19 | * |
||
20 | * @var CacheInterface|null |
||
21 | */ |
||
22 | protected $cache = null; |
||
23 | |||
24 | //-------------------------------------------------------------------- |
||
25 | |||
26 | public function __construct(LibraryFinderInterface $finder = null, CacheInterface $cache = null) |
||
38 | |||
39 | //-------------------------------------------------------------------- |
||
40 | |||
41 | |||
42 | /** |
||
43 | * The primary method used. Will attempt to locate the library, run |
||
44 | * the requested method, and return the rendered HTML. |
||
45 | * |
||
46 | * @param string $library |
||
47 | * @param string|array $params |
||
48 | * @param string $cache_name |
||
49 | * @param int $cache_ttl // Time in _minutes_ |
||
50 | * |
||
51 | * @return null|string |
||
52 | */ |
||
53 | public function display($library, $params=null, $cache_name=null, $cache_ttl=0) |
||
133 | |||
134 | //-------------------------------------------------------------------- |
||
135 | |||
136 | //-------------------------------------------------------------------- |
||
137 | // Utility Methods |
||
138 | //-------------------------------------------------------------------- |
||
139 | |||
140 | /** |
||
141 | * Attempts to locate and load the class passed in the library |
||
142 | * portion of the display() method. |
||
143 | * |
||
144 | * First, we will try to autoload the file. If it cannot be found there, |
||
145 | * we will try to run a framework-specific loader, if the user provided |
||
146 | * one in __construct(); |
||
147 | * |
||
148 | * @param $library |
||
149 | * @return array |
||
150 | */ |
||
151 | public function determineClass($library) |
||
194 | |||
195 | //-------------------------------------------------------------------- |
||
196 | |||
197 | /** |
||
198 | * Parses the params attribute. If an array, returns untouched. |
||
199 | * If a string, it should be in the format "key1=value key2=value". |
||
200 | * It will be split and returned as an array. |
||
201 | * |
||
202 | * @param $params |
||
203 | * @return array|null |
||
204 | */ |
||
205 | public function prepareParams($params) |
||
248 | |||
249 | //-------------------------------------------------------------------- |
||
250 | |||
251 | } |
||
252 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.