1 | <?php |
||
18 | class AbstractCallbackList extends ArrayObject implements Routinable |
||
19 | { |
||
20 | /** filters out non callable from the list, step copy to new storage */ |
||
21 | 40 | public function __construct(array $list = array()) |
|
38 | |||
39 | /** |
||
40 | * Public accessor methods, free for all (idempotent) |
||
41 | * |
||
42 | * @method getKeys to retrieve only the keys for conneg etc. |
||
43 | * @method hasKey check if key is present |
||
44 | * @method filterKeysContain fetch keys matching supplied string |
||
45 | * @method filterKeysNotContain fetch keys that don't include string |
||
46 | */ |
||
47 | 34 | public function getKeys() |
|
51 | 1 | public function hasKey($key) |
|
52 | { |
||
53 | 1 | return isset($this->$key); |
|
54 | |||
55 | return array_key_exists($key, $this); |
||
|
|||
56 | } |
||
57 | 24 | public function filterKeysContain($needle) |
|
58 | { |
||
59 | return array_filter($this->getKeys(), function ($key) use ($needle) { |
||
60 | 24 | return false !== strpos($key, $needle); |
|
61 | 24 | }); |
|
62 | } |
||
63 | public function filterKeysNotContain($needle) |
||
64 | { |
||
65 | 1 | return array_filter($this->getKeys(), function ($key) use ($needle) { |
|
66 | 1 | return false === strpos($key, $needle); |
|
67 | 1 | }); |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * Protected accessor methods, members only. |
||
72 | * |
||
73 | * @method getCallback return the configured callback associated with key |
||
74 | * @method executeCallback and forward supplied parmaters |
||
75 | */ |
||
76 | 30 | protected function getCallback($key) |
|
80 | |||
81 | 1 | protected function executeCallback($key, $params) |
|
85 | } |
||
86 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.