@@ -5,6 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * Small helper to render templates from strings |
7 | 7 | * Cloned from SSViewerTest |
8 | + * @param string $templateString |
|
8 | 9 | */ |
9 | 10 | private function render($templateString, $data = null) { |
10 | 11 | $t = SSViewer::fromString($templateString); |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | "Versioned('Stage', 'Live')" |
29 | 29 | ); |
30 | 30 | |
31 | + /** |
|
32 | + * @param string $entropy |
|
33 | + */ |
|
31 | 34 | public function setEntropy($entropy) { |
32 | 35 | $this->entropy = $entropy; |
33 | 36 | } |
@@ -53,6 +56,9 @@ discard block |
||
53 | 56 | SS_Cache::set_cache_lifetime('cacheblock', $cacheOn ? 600 : -1); |
54 | 57 | } |
55 | 58 | |
59 | + /** |
|
60 | + * @param string $template |
|
61 | + */ |
|
56 | 62 | protected function _runtemplate($template, $data = null) { |
57 | 63 | if ($data === null) $data = $this->data; |
58 | 64 | if (is_array($data)) $data = $this->data->customise($data); |
@@ -112,6 +112,10 @@ discard block |
||
112 | 112 | )); |
113 | 113 | } |
114 | 114 | |
115 | + /** |
|
116 | + * @param HTMLText $result |
|
117 | + * @param string[] $expected |
|
118 | + */ |
|
115 | 119 | private function assertExpectedStrings($result, $expected) { |
116 | 120 | foreach ($expected as $expectedStr) { |
117 | 121 | $this->assertTrue( |
@@ -718,6 +722,10 @@ discard block |
||
718 | 722 | $this->assertEquals('A A1 A1 i A1 ii A2 A3', $rationalisedResult); |
719 | 723 | } |
720 | 724 | |
725 | + /** |
|
726 | + * @param string $a |
|
727 | + * @param string $b |
|
728 | + */ |
|
721 | 729 | public function assertEqualIgnoringWhitespace($a, $b) { |
722 | 730 | $this->assertEquals(preg_replace('/\s+/', '', $a), preg_replace('/\s+/', '', $b)); |
723 | 731 | } |
@@ -1328,6 +1336,11 @@ discard block |
||
1328 | 1336 | Config::inst()->update('SSViewer', 'source_file_comments', false); |
1329 | 1337 | Config::inst()->update('Director', 'environment_type', $origEnv); |
1330 | 1338 | } |
1339 | + |
|
1340 | + /** |
|
1341 | + * @param string $name |
|
1342 | + * @param string $expected |
|
1343 | + */ |
|
1331 | 1344 | private function _renderWithSourceFileComments($name, $expected) { |
1332 | 1345 | $viewer = new SSViewer(array($name)); |
1333 | 1346 | $data = new ArrayData(array()); |
@@ -82,6 +82,10 @@ discard block |
||
82 | 82 | action treats a string as a single character. Wow! |
83 | 83 | action recognizes a regular expression if it is preceded by ( or , or =. |
84 | 84 | */ |
85 | + |
|
86 | + /** |
|
87 | + * @param integer $d |
|
88 | + */ |
|
85 | 89 | protected function action($d) { |
86 | 90 | switch($d) { |
87 | 91 | case 1: |
@@ -160,6 +164,9 @@ discard block |
||
160 | 164 | } |
161 | 165 | } |
162 | 166 | |
167 | + /** |
|
168 | + * @return string |
|
169 | + */ |
|
163 | 170 | protected function get() { |
164 | 171 | $c = $this->lookAhead; |
165 | 172 | $this->lookAhead = null; |
@@ -187,6 +194,10 @@ discard block |
||
187 | 194 | /* isAlphanum -- return true if the character is a letter, digit, underscore, |
188 | 195 | dollar sign, or non-ASCII character. |
189 | 196 | */ |
197 | + |
|
198 | + /** |
|
199 | + * @param string $c |
|
200 | + */ |
|
190 | 201 | protected function isAlphaNum($c) { |
191 | 202 | return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; |
192 | 203 | } |
@@ -92,6 +92,9 @@ |
||
92 | 92 | return $return; |
93 | 93 | } |
94 | 94 | |
95 | + /** |
|
96 | + * @param boolean $index |
|
97 | + */ |
|
95 | 98 | function f($index) { |
96 | 99 | return stripslashes($this->row[$index]); |
97 | 100 | } |
@@ -61,9 +61,17 @@ discard block |
||
61 | 61 | return $path; |
62 | 62 | } |
63 | 63 | |
64 | + /** |
|
65 | + * @param integer $parent |
|
66 | + * @param integer $position |
|
67 | + */ |
|
64 | 68 | function _create($parent, $position) { |
65 | 69 | return $this->_move(0, $parent, $position); |
66 | 70 | } |
71 | + |
|
72 | + /** |
|
73 | + * @param integer $id |
|
74 | + */ |
|
67 | 75 | function _remove($id) { |
68 | 76 | if((int)$id === 1) { return false; } |
69 | 77 | $data = $this->_get_node($id); |
@@ -100,6 +108,10 @@ discard block |
||
100 | 108 | ); |
101 | 109 | return true; |
102 | 110 | } |
111 | + |
|
112 | + /** |
|
113 | + * @param integer $id |
|
114 | + */ |
|
103 | 115 | function _move($id, $ref_id, $position = 0, $is_copy = false) { |
104 | 116 | if((int)$ref_id === 0 || (int)$id === 1) { return false; } |
105 | 117 | $sql = array(); // Queries executed at the end |
@@ -238,6 +250,10 @@ discard block |
||
238 | 250 | if($is_copy) $this->_fix_copy($ind, $position); |
239 | 251 | return $node === false || $is_copy ? $ind : true; |
240 | 252 | } |
253 | + |
|
254 | + /** |
|
255 | + * @param integer $position |
|
256 | + */ |
|
241 | 257 | function _fix_copy($id, $position) { |
242 | 258 | $node = $this->_get_node($id); |
243 | 259 | $children = $this->_get_children($id, true); |
@@ -48,6 +48,9 @@ discard block |
||
48 | 48 | return $str ; |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param string $id |
|
53 | + */ |
|
51 | 54 | function save($id) { |
52 | 55 | return PHPBuilder::build() |
53 | 56 | ->l( |
@@ -56,6 +59,9 @@ discard block |
||
56 | 59 | ); |
57 | 60 | } |
58 | 61 | |
62 | + /** |
|
63 | + * @param string $id |
|
64 | + */ |
|
59 | 65 | function restore( $id, $remove = FALSE ) { |
60 | 66 | $code = PHPBuilder::build() |
61 | 67 | ->l( |
@@ -71,6 +77,10 @@ discard block |
||
71 | 77 | return $code ; |
72 | 78 | } |
73 | 79 | |
80 | + /** |
|
81 | + * @param string $on |
|
82 | + * @param PHPBuilder $fail |
|
83 | + */ |
|
74 | 84 | function match_fail_conditional( $on, $match = NULL, $fail = NULL ) { |
75 | 85 | return PHPBuilder::build() |
76 | 86 | ->b( 'if (' . $on . ')', |
@@ -83,6 +93,9 @@ discard block |
||
83 | 93 | ); |
84 | 94 | } |
85 | 95 | |
96 | + /** |
|
97 | + * @param PHPBuilder $code |
|
98 | + */ |
|
86 | 99 | function match_fail_block( $code ) { |
87 | 100 | $id = $this->varid() ; |
88 | 101 | |
@@ -131,6 +144,9 @@ discard block |
||
131 | 144 | public $type ; |
132 | 145 | public $value ; |
133 | 146 | |
147 | + /** |
|
148 | + * @param string $type |
|
149 | + */ |
|
134 | 150 | function __construct( $type, $value = NULL ) { |
135 | 151 | $this->type = $type ; |
136 | 152 | $this->value = $value ; |
@@ -269,6 +285,10 @@ discard block |
||
269 | 285 | } |
270 | 286 | |
271 | 287 | class TokenLiteral extends TokenExpressionable { |
288 | + |
|
289 | + /** |
|
290 | + * @param string $value |
|
291 | + */ |
|
272 | 292 | function __construct( $value ) { |
273 | 293 | parent::__construct( 'literal', "'" . substr($value,1,-1) . "'" ); |
274 | 294 | } |
@@ -294,6 +314,9 @@ discard block |
||
294 | 314 | return $rx ; |
295 | 315 | } |
296 | 316 | |
317 | + /** |
|
318 | + * @param string $value |
|
319 | + */ |
|
297 | 320 | function __construct( $value ) { |
298 | 321 | parent::__construct('rx', self::escape($value)); |
299 | 322 | } |
@@ -304,6 +327,10 @@ discard block |
||
304 | 327 | } |
305 | 328 | |
306 | 329 | class TokenWhitespace extends TokenTerminal { |
330 | + |
|
331 | + /** |
|
332 | + * @param boolean $optional |
|
333 | + */ |
|
307 | 334 | function __construct( $optional ) { |
308 | 335 | parent::__construct( 'whitespace', $optional ) ; |
309 | 336 | } |
@@ -316,6 +343,10 @@ discard block |
||
316 | 343 | } |
317 | 344 | |
318 | 345 | class TokenRecurse extends Token { |
346 | + |
|
347 | + /** |
|
348 | + * @param string $value |
|
349 | + */ |
|
319 | 350 | function __construct( $value ) { |
320 | 351 | parent::__construct( 'recurse', $value ) ; |
321 | 352 | } |
@@ -438,6 +469,9 @@ discard block |
||
438 | 469 | $this->what = NULL ; |
439 | 470 | } |
440 | 471 | |
472 | + /** |
|
473 | + * @param string $what |
|
474 | + */ |
|
441 | 475 | function set( $what, $val = TRUE ) { |
442 | 476 | $this->what = $what ; |
443 | 477 | $this->val = $val ; |
@@ -498,6 +532,9 @@ discard block |
||
498 | 532 | public $mode; |
499 | 533 | public $rule; |
500 | 534 | |
535 | + /** |
|
536 | + * @param RuleSet $parser |
|
537 | + */ |
|
501 | 538 | function __construct($parser, $lines) { |
502 | 539 | $this->parser = $parser; |
503 | 540 | $this->lines = $lines; |
@@ -595,6 +632,9 @@ discard block |
||
595 | 632 | [^/] # Anything except / |
596 | 633 | )*/}xu' ; |
597 | 634 | |
635 | + /** |
|
636 | + * @param string $str |
|
637 | + */ |
|
598 | 638 | function tokenize( $str, &$tokens, $o = 0 ) { |
599 | 639 | |
600 | 640 | $pending = new Pending() ; |
@@ -848,6 +888,9 @@ discard block |
||
848 | 888 | return self::$parsers[$class]->compile($indent, $match[3]); |
849 | 889 | } |
850 | 890 | |
891 | + /** |
|
892 | + * @param string $string |
|
893 | + */ |
|
851 | 894 | static function compile( $string ) { |
852 | 895 | static $rx = '@ |
853 | 896 | ^([\x20\t]*)/\*!\* (?:[\x20\t]*(!?\w*))? # Start with some indent, a comment with the special marker, then an optional name |
@@ -9,6 +9,10 @@ discard block |
||
9 | 9 | * the bracket if a failed match + restore has moved the current position backwards - so we have to check that too. |
10 | 10 | */ |
11 | 11 | class ParserRegexp { |
12 | + |
|
13 | + /** |
|
14 | + * @param Parser $parser |
|
15 | + */ |
|
12 | 16 | function __construct( $parser, $rx ) { |
13 | 17 | $this->parser = $parser ; |
14 | 18 | $this->rx = $rx . 'Sx' ; |
@@ -63,6 +67,9 @@ discard block |
||
63 | 67 | return FALSE ; |
64 | 68 | } |
65 | 69 | |
70 | + /** |
|
71 | + * @param string $token |
|
72 | + */ |
|
66 | 73 | function literal( $token ) { |
67 | 74 | /* Debugging: * / print( "Looking for token '$token' @ '" . substr( $this->string, $this->pos ) . "'\n" ) ; /* */ |
68 | 75 | $toklen = strlen( $token ) ; |
@@ -74,11 +81,17 @@ discard block |
||
74 | 81 | return FALSE ; |
75 | 82 | } |
76 | 83 | |
84 | + /** |
|
85 | + * @param string $rx |
|
86 | + */ |
|
77 | 87 | function rx( $rx ) { |
78 | 88 | if ( !isset( $this->regexps[$rx] ) ) $this->regexps[$rx] = new ParserRegexp( $this, $rx ) ; |
79 | 89 | return $this->regexps[$rx]->match() ; |
80 | 90 | } |
81 | 91 | |
92 | + /** |
|
93 | + * @param string $value |
|
94 | + */ |
|
82 | 95 | function expression( $result, $stack, $value ) { |
83 | 96 | $stack[] = $result; $rv = false; |
84 | 97 | |
@@ -100,14 +113,23 @@ discard block |
||
100 | 113 | return is_array($rv) ? $rv['text'] : ($rv ? $rv : ''); |
101 | 114 | } |
102 | 115 | |
116 | + /** |
|
117 | + * @param string $key |
|
118 | + */ |
|
103 | 119 | function packhas( $key, $pos ) { |
104 | 120 | return false ; |
105 | 121 | } |
106 | 122 | |
123 | + /** |
|
124 | + * @param string $key |
|
125 | + */ |
|
107 | 126 | function packread( $key, $pos ) { |
108 | 127 | throw 'PackRead after PackHas=>false in Parser.php' ; |
109 | 128 | } |
110 | 129 | |
130 | + /** |
|
131 | + * @param string $key |
|
132 | + */ |
|
111 | 133 | function packwrite( $key, $pos, $res ) { |
112 | 134 | return $res ; |
113 | 135 | } |
@@ -144,6 +166,9 @@ discard block |
||
144 | 166 | return $result ; |
145 | 167 | } |
146 | 168 | |
169 | + /** |
|
170 | + * @param string $storetag |
|
171 | + */ |
|
147 | 172 | function store ( &$result, $subres, $storetag = NULL ) { |
148 | 173 | $result['text'] .= $subres['text'] ; |
149 | 174 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Creates a copy whether in PHP5 or PHP4. |
17 | - * @param object $object Thing to copy. |
|
17 | + * @param SimpleFormTag $object Thing to copy. |
|
18 | 18 | * @return object A copy. |
19 | 19 | * @access public |
20 | 20 | * @static |