Conditions | 4 |
Paths | 7 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
29 | 5 | private function resolveFakerValue(array $matches): mixed |
|
30 | { |
||
31 | try { |
||
32 | 5 | $methodName = $matches[1]; |
|
33 | 5 | $arguments = json_decode('['.$matches[2].']', true, 512, JSON_THROW_ON_ERROR); |
|
34 | |||
35 | 4 | return $this->faker->__call( |
|
36 | 4 | $methodName, |
|
37 | 4 | \is_array($arguments) ? $arguments : [$arguments] |
|
38 | 4 | ); |
|
39 | 2 | } catch (InvalidArgumentException) { |
|
|
|||
40 | 1 | } catch (JsonException $error) { |
|
41 | 1 | $message = sprintf( |
|
42 | 1 | "Can't extract the arguments to call method %s: [%s]", |
|
43 | 1 | $matches[1], |
|
44 | 1 | $matches[2] |
|
45 | 1 | ); |
|
46 | 1 | throw new InvalidArgumentException($message, 0, $error); |
|
47 | } |
||
48 | |||
49 | 1 | return null; |
|
50 | } |
||
52 |