1 | <?php |
||
2 | |||
3 | /** |
||
4 | * This file is part of Nepttune (https://www.peldax.com) |
||
5 | * |
||
6 | * Copyright (c) 2018 Václav Pelíšek ([email protected]) |
||
7 | * |
||
8 | * This software consists of voluntary contributions made by many individuals |
||
9 | * and is licensed under the MIT license. For more information, see |
||
10 | * <https://www.peldax.com>. |
||
11 | */ |
||
12 | |||
13 | declare(strict_types = 1); |
||
14 | |||
15 | namespace Nepttune\Latte; |
||
16 | |||
17 | final class IconMacro extends \Latte\Macros\MacroSet |
||
18 | { |
||
19 | public static function install(\Latte\Compiler $compiler) |
||
20 | { |
||
21 | $set = new static($compiler); |
||
22 | $set->addMacro('icon', function($node, $writer) |
||
23 | { |
||
24 | return $writer->write('echo \Nepttune\Latte\IconMacro::renderIcon(%node.word, %node.array)'); |
||
25 | }); |
||
26 | $set->addMacro('iconFA4', function($node, $writer) |
||
27 | { |
||
28 | return $writer->write('echo \Nepttune\Latte\IconMacro::renderIconFA4(%node.word, %node.array)'); |
||
29 | }); |
||
30 | } |
||
31 | |||
32 | public static function renderIcon($icon, array $params = []) |
||
33 | { |
||
34 | $el = \Nette\Utils\Html::el('i'); |
||
0 ignored issues
–
show
|
|||
35 | |||
36 | $type = $params['type'] ?? 's'; |
||
37 | $fw = $params['fw'] ?? true; |
||
38 | |||
39 | $el->addAttributes(['class' => "fa{$type} fa-{$icon}"]); |
||
40 | |||
41 | if ($fw) |
||
42 | { |
||
43 | $el->appendAttribute('class', 'fa-fw'); |
||
44 | } |
||
45 | |||
46 | if (isset($params['size'])) |
||
47 | { |
||
48 | $el->appendAttribute('class', 'fa-'.$params['size']); |
||
49 | } |
||
50 | |||
51 | if (isset($params['spin']) && $params['spin']) |
||
52 | { |
||
53 | $el->appendAttribute('class', 'fa-spin'); |
||
54 | } |
||
55 | |||
56 | if (isset($params['pulse']) && $params['pulse']) |
||
57 | { |
||
58 | $el->appendAttribute('class', 'fa-pulse'); |
||
59 | } |
||
60 | |||
61 | if (isset($params['rotate']) && $params['rotate']) |
||
62 | { |
||
63 | $el->appendAttribute('class', 'fa-rotate-'.$params['rotate']); |
||
64 | } |
||
65 | |||
66 | if (isset($params['flip']) && $params['flip']) |
||
67 | { |
||
68 | $el->appendAttribute('class', 'fa-flip-'.$params['flip']); |
||
69 | } |
||
70 | |||
71 | return $el; |
||
72 | } |
||
73 | |||
74 | public static function renderIconFA4($icon, array $params = []) |
||
75 | { |
||
76 | $el = \Nette\Utils\Html::el('i'); |
||
77 | $el->addAttributes(['class' => 'fa fa-'.$icon]); |
||
78 | |||
79 | $fw = $params['fw'] ?? true; |
||
80 | |||
81 | if ($fw) |
||
82 | { |
||
83 | $el->appendAttribute('class', 'fa-fw'); |
||
84 | } |
||
85 | |||
86 | if (isset($params['size'])) |
||
87 | { |
||
88 | $el->appendAttribute('class', 'fa-'.$params['size']); |
||
89 | } |
||
90 | |||
91 | return $el; |
||
92 | } |
||
93 | } |
||
94 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths