1 | <?php |
||
21 | class CSS extends ExternalModule |
||
22 | { |
||
23 | /** @var string Module identifer */ |
||
24 | protected $id = 'resource_css'; |
||
25 | |||
26 | /** Pattern for matching CSS url */ |
||
27 | const P_URL = '/url\s*\(\s*(\'|\")?([^\)\s\'\"]+)(\'|\")?\s*\)/i'; |
||
28 | |||
29 | /** Event for firing before handling CSS resource */ |
||
30 | const E_BEFORE_HANDLER = 'samsonphp.css.before_handle'; |
||
31 | |||
32 | /** Event for firing after handling CSS resource */ |
||
33 | const E_AFTER_HANDLER = 'samsonphp.css.after_handle'; |
||
34 | |||
35 | /** @var string Path to current resource file */ |
||
36 | protected $currentResource; |
||
37 | |||
38 | /** Module preparation stage handler */ |
||
39 | 5 | public function prepare(array $params = []) |
|
46 | |||
47 | /** |
||
48 | * LESS resource compiler. |
||
49 | * |
||
50 | * @param string $resource Resource full path |
||
51 | * @param string $extension Resource extension |
||
52 | * @param string $content Compiled output resource content |
||
53 | */ |
||
54 | 5 | public function compile($resource, $extension, &$content) |
|
69 | |||
70 | /** |
||
71 | * Callback for CSS url(...) rewriting. |
||
72 | * |
||
73 | * @param array $matches Regular expression matches collection |
||
74 | * |
||
75 | * @return string Rewritten url(..) with static resource handler url |
||
76 | * @throws ResourceNotFound |
||
77 | */ |
||
78 | 5 | public function rewriteUrls($matches) |
|
101 | |||
102 | /** |
||
103 | * Get only path or URL before marker. |
||
104 | * |
||
105 | * @param string $path Full URL with possible unneeded data |
||
106 | * @param string $marker Marker for separation |
||
107 | * |
||
108 | * @return string Filtered asset URL |
||
109 | */ |
||
110 | 4 | protected function getOnlyUrl($path, $marker) |
|
119 | } |
||
120 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.