| Conditions | 4 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.25 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function mustBeInArray($value, array $availableValues, string $propertyPath = null, UIValidatorInterface $parentValidator = null, string $exceptionMessage = null) |
||
| 24 | { |
||
| 25 | 1 | $this->validationEngine->validateFieldValue( |
|
| 26 | 1 | $parentValidator ?: $this, |
|
| 27 | 1 | function() use ($value, $availableValues, $propertyPath, $exceptionMessage) { |
|
| 28 | 1 | if (!in_array($value, $availableValues, true)) { |
|
| 29 | 1 | if (null === $exceptionMessage) { |
|
| 30 | $exceptionMessage = sprintf( |
||
|
|
|||
| 31 | 'The value "%s" is not valid. Available values are "%s".', |
||
| 32 | $value, |
||
| 33 | implode('", "', $availableValues) |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | 1 | throw new InvalidArgumentException( |
|
| 38 | $exceptionMessage, |
||
| 39 | 1 | 0, |
|
| 40 | $propertyPath, |
||
| 41 | $value |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | 1 | } |
|
| 45 | ); |
||
| 46 | |||
| 47 | 1 | return $value; |
|
| 48 | } |
||
| 49 | } |
||
| 50 |
It seems like you are assigning to a variable which was imported through a
usestatement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope