These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace League\Plates\Template; |
||
4 | |||
5 | use League\Plates\Template; |
||
6 | |||
7 | function matchPathExtension(callable $match) { |
||
8 | return matchAttribute('path', function($path) use ($match) { |
||
9 | 16 | return $match(pathinfo($path, PATHINFO_EXTENSION)); |
|
10 | 16 | }); |
|
11 | } |
||
12 | |||
13 | function matchName($name) { |
||
14 | return function(Template $template) use ($name) { |
||
15 | 16 | return $template->get('normalized_name', $template->name) == $name; |
|
16 | 16 | }; |
|
17 | } |
||
18 | |||
19 | function matchExtensions(array $extensions) { |
||
20 | return matchPathExtension(function($ext) use ($extensions) { |
||
21 | 16 | return in_array($ext, $extensions); |
|
22 | 16 | }); |
|
23 | } |
||
24 | |||
25 | function matchAttribute($attribute, callable $match) { |
||
26 | return function(Template $template) use ($attribute, $match) { |
||
27 | 4 | return $match($template->get($attribute)); |
|
28 | 20 | }; |
|
29 | } |
||
30 | |||
31 | function matchStub($res) { |
||
32 | return function(Template $template) use ($res) { |
||
0 ignored issues
–
show
|
|||
33 | return $res; |
||
34 | }; |
||
35 | } |
||
36 | |||
37 | function matchAny(array $matches) { |
||
38 | return function(Template $template) use ($matches) { |
||
39 | foreach ($matches as $match) { |
||
40 | if ($match($template)) { |
||
41 | return true; |
||
42 | } |
||
43 | } |
||
44 | |||
45 | return false; |
||
46 | }; |
||
47 | } |
||
48 | |||
49 | function matchAll(array $matches) { |
||
50 | return function(Template $template) use ($matches) { |
||
51 | foreach ($matches as $match) { |
||
52 | if (!$match($template)) { |
||
53 | return false; |
||
54 | } |
||
55 | } |
||
56 | |||
57 | return true; |
||
58 | }; |
||
59 | } |
||
60 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.