@@ -55,7 +55,7 @@ class VerEx {
55
55
* @param string $value the to be added
56
56
* @return string escaped value
57
57
*/
58
- public function sanitize ($ value )
58
+ public function sanitize ($ value )
59
59
{
60
60
if (!$ value ) {
61
61
return $ value ;
@@ -66,13 +66,13 @@ public function sanitize($value)
66
66
/**
67
67
* Add
68
68
*
69
- * Add stuff to the expression
69
+ * Add stuff to the expression
70
70
*
71
71
* @access public
72
72
* @param string $value the stuff to be added
73
73
* @return VerEx
74
74
*/
75
- public function add ($ value )
75
+ public function add ($ value )
76
76
{
77
77
$ this ->source .= $ value ;
78
78
return $ this ;
@@ -102,7 +102,7 @@ public function startOfLine($enable = true)
102
102
* @param boolean $enable Enables or disables the line ending. Default value: true
103
103
* @return VerEx
104
104
*/
105
- public function endOfLine ($ enable = true )
105
+ public function endOfLine ($ enable = true )
106
106
{
107
107
$ this ->suffixes = $ enable ? "$ " : "" ;
108
108
return $ this ;
@@ -117,7 +117,7 @@ public function endOfLine($enable = true)
117
117
* @param string $value The string to be looked for
118
118
* @return VerEx
119
119
*/
120
- public function then ($ value )
120
+ public function then ($ value )
121
121
{
122
122
$ this ->add ("( " .$ this ->sanitize ($ value ).") " );
123
123
return $ this ;
@@ -127,7 +127,7 @@ public function then($value)
127
127
* alias for then()
128
128
* @param string $value The string to be looked for
129
129
*/
130
- public function find ($ value )
130
+ public function find ($ value )
131
131
{
132
132
return $ this ->then ($ value );
133
133
}
@@ -141,7 +141,7 @@ public function find($value)
141
141
* @param string $value The string to be looked for
142
142
* @return VerEx
143
143
*/
144
- public function maybe ($ value )
144
+ public function maybe ($ value )
145
145
{
146
146
$ this ->add ("( " .$ this ->sanitize ($ value ).")? " );
147
147
return $ this ;
@@ -153,9 +153,9 @@ public function maybe($value)
153
153
* Accept any string
154
154
*
155
155
* @access public
156
- * @return VerEx
156
+ * @return VerEx
157
157
*/
158
- public function anything ()
158
+ public function anything ()
159
159
{
160
160
$ this ->add ("(.*) " );
161
161
return $ this ;
@@ -170,7 +170,7 @@ public function anything()
170
170
* @param string $value The unaccepted chars
171
171
* @return VerEx
172
172
*/
173
- public function anythingBut ($ value )
173
+ public function anythingBut ($ value )
174
174
{
175
175
$ this ->add ("([^ " . $ this ->sanitize ($ value ) ."]*) " );
176
176
return $ this ;
@@ -179,12 +179,12 @@ public function anythingBut($value)
179
179
/**
180
180
* Something
181
181
*
182
- * Accept any non-empty string
182
+ * Accept any non-empty string
183
183
*
184
184
* @access public
185
185
* @return VerEx
186
186
*/
187
- public function something ()
187
+ public function something ()
188
188
{
189
189
$ this ->add ("(.+) " );
190
190
return $ this ;
@@ -199,7 +199,7 @@ public function something()
199
199
* @param string $value The unaccepted chars
200
200
* @return VerEx
201
201
*/
202
- public function somethingBut ($ value )
202
+ public function somethingBut ($ value )
203
203
{
204
204
$ this ->add ("([^ " . $ this ->sanitize ($ value ) ."]+) " );
205
205
return $ this ;
@@ -215,13 +215,13 @@ public function somethingBut($value)
215
215
* @param string $value the replacement
216
216
* @return VerEx
217
217
*/
218
- public function replace ($ source , $ value )
218
+ public function replace ($ source , $ value )
219
219
{
220
220
// php doesn't have g modifier so we remove it if it's there and we remove limit param
221
221
if (strpos ($ this ->modifiers , 'g ' ) !== false ) {
222
222
$ this ->modifiers = str_replace ('g ' , '' , $ this ->modifiers );
223
223
return preg_replace ($ this ->getRegex (), $ value , $ source );
224
- }
224
+ }
225
225
226
226
return preg_replace ($ this ->getRegex (), $ value , $ source , $ this ->replaceLimit );
227
227
}
@@ -234,7 +234,7 @@ public function replace($source, $value)
234
234
* @access public
235
235
* @return VerEx
236
236
*/
237
- public function lineBreak ()
237
+ public function lineBreak ()
238
238
{
239
239
$ this ->add ("( \\n|( \\r \\n)) " );
240
240
return $ this ;
@@ -248,7 +248,7 @@ public function lineBreak()
248
248
* @access public
249
249
* return object
250
250
*/
251
- public function br ()
251
+ public function br ()
252
252
{
253
253
return $ this ->lineBreak ();
254
254
}
@@ -261,7 +261,7 @@ public function br()
261
261
* @access public
262
262
* @return VerEx
263
263
*/
264
- public function tab ()
264
+ public function tab ()
265
265
{
266
266
$ this ->add ("\\t " );
267
267
return $ this ;
@@ -275,7 +275,7 @@ public function tab()
275
275
* @access public
276
276
* @return VerEx
277
277
*/
278
- public function word ()
278
+ public function word ()
279
279
{
280
280
$ this ->add ("\\w+ " );
281
281
return $ this ;
@@ -290,7 +290,7 @@ public function word()
290
290
* @param string $value The chars looked for
291
291
* @return VerEx
292
292
*/
293
- public function anyOf ($ value )
293
+ public function anyOf ($ value )
294
294
{
295
295
$ this ->add ("[ " . $ value ."] " );
296
296
return $ this ;
@@ -305,7 +305,7 @@ public function anyOf($value)
305
305
* @param string $value The chars looked for
306
306
* @return VerEx
307
307
*/
308
- public function any ($ value )
308
+ public function any ($ value )
309
309
{
310
310
return $ this ->anyOf ($ value );
311
311
}
@@ -318,7 +318,7 @@ public function any($value)
318
318
* @access public
319
319
* @return VerEx
320
320
*/
321
- public function range ()
321
+ public function range ()
322
322
{
323
323
324
324
$ arg_num = func_num_args ();
@@ -346,7 +346,7 @@ public function range()
346
346
* Add a modifier
347
347
*
348
348
* Adds a modifier
349
- *
349
+ *
350
350
* @access public
351
351
* @param str $modifier
352
352
* @return VerEx
@@ -406,7 +406,7 @@ public function withAnyCase($enable = true)
406
406
* @param boolean $enable Enables or disables g modifier. Default true
407
407
* @return VerEx
408
408
*/
409
- public function stopAtFirst ($ enable = true )
409
+ public function stopAtFirst ($ enable = true )
410
410
{
411
411
if ($ enable ) {
412
412
$ this ->addModifier ('g ' );
@@ -427,7 +427,7 @@ public function stopAtFirst($enable = true)
427
427
* @param boolean $enable Enables or disables m modifier. Default true
428
428
* @return VerEx
429
429
*/
430
- public function searchOneLine ($ enable = true )
430
+ public function searchOneLine ($ enable = true )
431
431
{
432
432
if ($ enable ===true ) {
433
433
$ this ->addModifier ('m ' );
@@ -448,7 +448,7 @@ public function searchOneLine($enable = true)
448
448
* @param string $value Your expresion
449
449
* @return VerEx
450
450
*/
451
- public function multiple ($ value )
451
+ public function multiple ($ value )
452
452
{
453
453
$ value = $ this ->sanitize ($ value );
454
454
@@ -457,7 +457,7 @@ public function multiple($value)
457
457
case '+ ' :
458
458
case '* ' :
459
459
break ;
460
-
460
+
461
461
default :
462
462
$ value += '+ ' ;
463
463
break ;
@@ -504,7 +504,7 @@ public function _or($value)
504
504
* @access public
505
505
* @return string
506
506
*/
507
- public function __toString ()
507
+ public function __toString ()
508
508
{
509
509
return $ this ->getRegex ();
510
510
}
@@ -517,7 +517,7 @@ public function __toString()
517
517
* @access public
518
518
* @return string The final regex
519
519
*/
520
- public function getRegex ()
520
+ public function getRegex ()
521
521
{
522
522
return "/ " .$ this ->prefixes .$ this ->source .$ this ->suffixes ."/ " .$ this ->modifiers ;
523
523
}
@@ -545,14 +545,14 @@ public function test($value)
545
545
546
546
/**
547
547
* Clean
548
- *
548
+ *
549
549
* deletes the current regex for a fresh start
550
550
*
551
551
* @access public
552
552
* @param array $options
553
553
* @return VerEx
554
554
*/
555
- public function clean ($ options = array ())
555
+ public function clean ($ options = array ())
556
556
{
557
557
$ options = array_merge (array ("prefixes " => "" , "source " =>"" , "suffixes " =>"" , "modifiers " =>"gm " ,"replaceLimit " =>"1 " ), $ options );
558
558
$ this ->prefixes = $ options ['prefixes ' ];
0 commit comments