12
12
*/
13
13
class Variable
14
14
{
15
- const EXCEPTION_CAST_TEXT = 'Can not cast ${{variable}} to {{type}} ' ;
16
-
17
15
const EXCEPTION_CLASS = '\InvalidArgumentException ' ;
18
16
19
- const EXCEPTION_LENGTH_TEXT_NEGATIVE = '${{variable}} must have not length {{value}} ' ;
20
-
21
17
const EXCEPTION_LENGTH_TEXT_POSITIVE = '${{variable}} must have length {{value}} ' ;
22
18
23
19
const EXCEPTION_TYPE_TEXT_NEGATIVE = 'Param ${{variable}} must be not {{type}} ' ;
24
20
25
21
const EXCEPTION_TYPE_TEXT_POSITIVE = 'Param ${{variable}} must be {{type}} ' ;
26
22
27
- const EXCEPTION_VALUE_IN_ARRAY_NEGATIVE = '${{variable}} must be not in range {{value}} ' ;
28
-
29
23
const EXCEPTION_VALUE_IN_ARRAY_POSITIVE = '${{variable}} out of range {{value}} ' ;
30
24
31
25
const EXCEPTION_VALUE_TEXT_NEGATIVE = 'Param ${{variable}} must be not {{value}} ' ;
32
26
33
27
const EXCEPTION_VALUE_TEXT_POSITIVE = 'Param ${{variable}} must be {{value}} ' ;
34
28
35
- const EXCEPTION_VALUE_REG_EXP_NEGATIVE = 'Param ${{variable}} must apply pattern {{pattern}} ' ;
36
-
37
- const EXCEPTION_VALUE_REG_EXP_POSITIVE = 'Param ${{variable}} must not apply pattern {{pattern}} ' ;
29
+ const EXCEPTION_VALUE_PATTERN_POSITIVE = 'Param ${{variable}} must apply pattern {{pattern}} ' ;
38
30
39
31
/** @var Variable */
40
32
protected static $ validator ;
@@ -424,7 +416,7 @@ public function isEmpty()
424
416
public function notEmpty ()
425
417
{
426
418
if (empty ($ this ->value )) {
427
- throw $ this ->buildException (self ::EXCEPTION_TYPE_TEXT_NEGATIVE , ['{{type}} ' => 'empty ' ]);
419
+ throw $ this ->buildException (self ::EXCEPTION_VALUE_TEXT_NEGATIVE , ['{{type}} ' => 'empty ' ]);
428
420
}
429
421
430
422
return $ this ;
@@ -587,7 +579,7 @@ public function match($pattern)
587
579
}
588
580
589
581
if ($ checkResult === 0 ) {
590
- throw $ this ->buildException (self ::EXCEPTION_VALUE_REG_EXP_POSITIVE , ['{{pattern}} ' => $ pattern ]);
582
+ throw $ this ->buildException (self ::EXCEPTION_VALUE_PATTERN_POSITIVE , ['{{pattern}} ' => $ pattern ]);
591
583
}
592
584
593
585
return $ this ;
@@ -612,7 +604,7 @@ public function glob($pattern)
612
604
}
613
605
614
606
if (!fnmatch ($ pattern , $ this ->value )) {
615
- throw $ this ->buildException (self ::EXCEPTION_VALUE_REG_EXP_NEGATIVE , ['{{pattern}} ' => $ pattern ]);
607
+ throw $ this ->buildException (self ::EXCEPTION_VALUE_PATTERN_POSITIVE , ['{{pattern}} ' => $ pattern ]);
616
608
}
617
609
618
610
return $ this ;
0 commit comments