| Total Complexity | 7 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 80% |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | class IsNumeric extends AbstractConstraint |
||
| 25 | { |
||
| 26 | |||
| 27 | /** |
||
|
1 ignored issue
–
show
|
|||
| 28 | * @param string $variable |
||
|
3 ignored issues
–
show
|
|||
| 29 | * @param stdClass $data |
||
|
2 ignored issues
–
show
|
|||
| 30 | * @return bool |
||
|
1 ignored issue
–
show
|
|||
| 31 | */ |
||
| 32 | 14 | protected function matchForVariable($variable, $data) |
|
| 33 | { |
||
| 34 | 14 | if (isset($data->{$variable})) { |
|
| 35 | 4 | return $this->parseValue($data->{$variable}); |
|
| 36 | } |
||
| 37 | 11 | return false; |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Tests whether the given variables (Appendix IV - Variables) contain numeric content. Content is considered |
||
| 42 | * numeric if it solely consists of numbers. Numbers may have prefixes and suffixes (“D2”, “2b”, “L2d”), and may be |
||
| 43 | * separated by a comma, hyphen, or ampersand, with or without spaces (“2, 3”, “2-4”, “2 & 4”). For example, “2nd” |
||
| 44 | * tests “true” whereas “second” and “2nd edition” test “false”. |
||
| 45 | * |
||
| 46 | * @param $evalValue |
||
|
2 ignored issues
–
show
|
|||
| 47 | * @return bool |
||
|
1 ignored issue
–
show
|
|||
| 48 | */ |
||
| 49 | 4 | private function parseValue($evalValue) |
|
| 62 | } |
||
| 63 | } |
||
| 64 |