1 | <?php |
||
11 | class Variable implements FilterInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var array $frontmatter parsed as frontmatter, accumulated when parsing |
||
15 | * the text. |
||
16 | */ |
||
17 | protected $frontmatter; |
||
18 | |||
19 | |||
20 | |||
21 | /** |
||
22 | * Parse the text through the filter and do what the filter does, |
||
23 | * return the resulting text and with some optional additional details, |
||
24 | * all wrapped in an key-value array. |
||
25 | * |
||
26 | * @param string $text to parse. |
||
27 | * @param array $frontmatter optional to use while parsing. |
||
28 | * @param array $options custom options to use while parsing. |
||
29 | * |
||
30 | * @return array with the resulting text and frontmatter. |
||
31 | */ |
||
32 | 4 | public function parse($text, array $frontmatter, array $options = []) |
|
42 | |||
43 | |||
44 | |||
45 | /** |
||
46 | * Detect variable expressions %var% and replace with their values, if the |
||
47 | * variable is defined. |
||
48 | * |
||
49 | * @param string $text to parse for variable expressions.. |
||
50 | * |
||
51 | * @return string as parsed text where variable are replaced with values. |
||
52 | */ |
||
53 | 4 | protected function parseForVariable($text) |
|
63 | |||
64 | |||
65 | |||
66 | /** |
||
67 | * Detect and extract inline variables. |
||
68 | * |
||
69 | * @param string $text to parse. |
||
|
|||
70 | * |
||
71 | * @return boolean|void true when block is found and parsed, else void. |
||
72 | * |
||
73 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
||
74 | */ |
||
75 | 4 | protected function getVariableValue(array $matches) |
|
86 | } |
||
87 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.