@@ -50,6 +50,9 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | + /** |
|
54 | + * @param boolean $append |
|
55 | + */ |
|
53 | 56 | private function ensureEcho($append) { |
54 | 57 | if (!$this->inEcho) { |
55 | 58 | $this->buffer .= $this->px().'echo '; |
@@ -137,7 +140,7 @@ discard block |
||
137 | 140 | /** |
138 | 141 | * Get the depth. |
139 | 142 | * |
140 | - * @return mixed Returns the depth. |
|
143 | + * @return integer Returns the depth. |
|
141 | 144 | */ |
142 | 145 | public function getDepth() { |
143 | 146 | return $this->depth; |
@@ -90,6 +90,11 @@ |
||
90 | 90 | $this->compiler->defineFunction($name, $function); |
91 | 91 | } |
92 | 92 | |
93 | + /** |
|
94 | + * @param string $func |
|
95 | + * |
|
96 | + * @return callable|null |
|
97 | + */ |
|
93 | 98 | private function mb($func) { |
94 | 99 | return function_exists("mb_$func") ? "mb_$func" : $func; |
95 | 100 | } |
@@ -39,6 +39,9 @@ |
||
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
42 | + /** |
|
43 | + * @param string $name |
|
44 | + */ |
|
42 | 45 | public function getFunctionCompiler($name) { |
43 | 46 | if (isset($this->functions[$name])) { |
44 | 47 | return $this->functions[$name]['compiler']; |
@@ -7,7 +7,6 @@ |
||
7 | 7 | |
8 | 8 | namespace Ebi; |
9 | 9 | |
10 | -use Symfony\Component\ExpressionLanguage\ExpressionFunction; |
|
11 | 10 | use Symfony\Component\ExpressionLanguage\Node\GetAttrNode; |
12 | 11 | |
13 | 12 | class ExpressionLanguage extends \Symfony\Component\ExpressionLanguage\ExpressionLanguage { |
@@ -50,6 +50,9 @@ |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | + /** |
|
54 | + * @param string $component |
|
55 | + */ |
|
53 | 56 | private function componentPath($component, $full = true) { |
54 | 57 | $subpath = str_replace('.', DIRECTORY_SEPARATOR, $component); |
55 | 58 |
@@ -60,6 +60,7 @@ discard block |
||
60 | 60 | * Select a specific component buffer. |
61 | 61 | * @param string $component The name of the component to select. |
62 | 62 | * @param bool $add Whether to add a new component if there is already a compile buffer with the same name. |
63 | + * @return string |
|
63 | 64 | */ |
64 | 65 | public function select($component, $add = false) { |
65 | 66 | $previous = $this->currentName; |
@@ -95,6 +96,9 @@ discard block |
||
95 | 96 | $this->current->echoLiteral($value); |
96 | 97 | } |
97 | 98 | |
99 | + /** |
|
100 | + * @param string $php |
|
101 | + */ |
|
98 | 102 | public function echoCode($php) { |
99 | 103 | $this->current->echoCode($php); |
100 | 104 | } |
@@ -103,6 +107,9 @@ discard block |
||
103 | 107 | $this->current->appendCode($php); |
104 | 108 | } |
105 | 109 | |
110 | + /** |
|
111 | + * @param integer $add |
|
112 | + */ |
|
106 | 113 | public function indent($add) { |
107 | 114 | $this->current->indent($add); |
108 | 115 | } |
@@ -111,6 +118,9 @@ discard block |
||
111 | 118 | $this->current->depth($add); |
112 | 119 | } |
113 | 120 | |
121 | + /** |
|
122 | + * @param string $name |
|
123 | + */ |
|
114 | 124 | public function depthName($name, $add = 0) { |
115 | 125 | return $this->current->depthName($name, $add); |
116 | 126 | } |
@@ -225,6 +235,9 @@ discard block |
||
225 | 235 | return $this; |
226 | 236 | } |
227 | 237 | |
238 | + /** |
|
239 | + * @param string $name |
|
240 | + */ |
|
228 | 241 | public function getNodeProp(\DOMNode $node, $name, $default = null) { |
229 | 242 | if (!$this->nodeProps->contains($node) || !array_key_exists($name, $this->nodeProps[$node])) { |
230 | 243 | return $default; |
@@ -232,6 +245,10 @@ discard block |
||
232 | 245 | return $this->nodeProps[$node][$name]; |
233 | 246 | } |
234 | 247 | |
248 | + /** |
|
249 | + * @param string $name |
|
250 | + * @param boolean $value |
|
251 | + */ |
|
235 | 252 | public function setNodeProp(\DOMNode $node = null, $name, $value) { |
236 | 253 | if ($node === null) { |
237 | 254 | return $this; |
@@ -268,6 +268,11 @@ discard block |
||
268 | 268 | ); |
269 | 269 | } |
270 | 270 | |
271 | + /** |
|
272 | + * @param callable $function |
|
273 | + * |
|
274 | + * @return callable |
|
275 | + */ |
|
271 | 276 | private function getFunctionEvaluator($function) { |
272 | 277 | if ($function === 'empty') { |
273 | 278 | return function ($expr) { |
@@ -282,6 +287,10 @@ discard block |
||
282 | 287 | return $function; |
283 | 288 | } |
284 | 289 | |
290 | + /** |
|
291 | + * @param string $name |
|
292 | + * @param callable $function |
|
293 | + */ |
|
285 | 294 | private function getFunctionCompiler($name, $function) { |
286 | 295 | $var = var_export(strtolower($name), true); |
287 | 296 | $fn = function ($expr) use ($var) { |
@@ -362,6 +371,9 @@ discard block |
||
362 | 371 | return $r; |
363 | 372 | } |
364 | 373 | |
374 | + /** |
|
375 | + * @param string $tag |
|
376 | + */ |
|
365 | 377 | protected function isComponent($tag) { |
366 | 378 | return !isset(static::$htmlTags[$tag]); |
367 | 379 | } |
@@ -492,6 +504,9 @@ discard block |
||
492 | 504 | } |
493 | 505 | } |
494 | 506 | |
507 | + /** |
|
508 | + * @param string $value |
|
509 | + */ |
|
495 | 510 | protected function splitExpressions($value) { |
496 | 511 | $values = preg_split('`({\S[^}]*?})`', $value, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE); |
497 | 512 | return $values; |
@@ -844,6 +859,9 @@ discard block |
||
844 | 859 | } |
845 | 860 | } |
846 | 861 | |
862 | + /** |
|
863 | + * @param string $value |
|
864 | + */ |
|
847 | 865 | private function isExpression($value) { |
848 | 866 | return preg_match('`^{\S.*}$`', $value); |
849 | 867 | } |
@@ -1115,8 +1133,8 @@ discard block |
||
1115 | 1133 | /** |
1116 | 1134 | * Whether or not a node can be skipped for the purposes of trimming whitespace. |
1117 | 1135 | * |
1118 | - * @param DOMNode|null $node The node to test. |
|
1119 | - * @param CompilerBuffer|null $out The compiler information. |
|
1136 | + * @param DOMNode $node The node to test. |
|
1137 | + * @param CompilerBuffer $out The compiler information. |
|
1120 | 1138 | * @return bool Returns **true** if whitespace can be trimmed right up to the node or **false** otherwise. |
1121 | 1139 | */ |
1122 | 1140 | private function canSkip(\DOMNode $node, CompilerBuffer $out) { |
@@ -1250,7 +1268,7 @@ discard block |
||
1250 | 1268 | * |
1251 | 1269 | * @param DOMNode $node |
1252 | 1270 | * @param callable $test |
1253 | - * @return bool |
|
1271 | + * @return DOMNode |
|
1254 | 1272 | */ |
1255 | 1273 | private function closest(\DOMNode $node, callable $test) { |
1256 | 1274 | for ($visitor = $node; $visitor !== null && !$test($visitor); $visitor = $visitor->parentNode) { |
@@ -1275,6 +1293,9 @@ discard block |
||
1275 | 1293 | $this->compileCloseTag($node, $special, $out); |
1276 | 1294 | } |
1277 | 1295 | |
1296 | + /** |
|
1297 | + * @param string $php |
|
1298 | + */ |
|
1278 | 1299 | protected function compileEscape($php) { |
1279 | 1300 | // return 'htmlspecialchars('.$php.')'; |
1280 | 1301 | return '$this->escape('.$php.')'; |