Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
35 | 15 | public function getRules($state = null) |
|
36 | { |
||
37 | 15 | $method = Str::camel($state ?: 'default'); |
|
38 | |||
39 | 15 | if ( ! method_exists($this->repository, $method)) { |
|
40 | 1 | throw new NonExistentStateException($method); |
|
41 | } |
||
42 | |||
43 | 14 | return array_merge( |
|
44 | 14 | $this->repository->default(), |
|
45 | 14 | is_array($this->repository->$method()) ? $this->repository->$method() : [] |
|
46 | ); |
||
49 |