| Conditions | 4 |
| Paths | 4 |
| Total Lines | 29 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function getAllMethods() |
||
| 33 | { |
||
| 34 | $configuredMethods = (array) static::config()->get('methods'); |
||
| 35 | |||
| 36 | $allMethods = []; |
||
| 37 | |||
| 38 | foreach ($configuredMethods as $method) { |
||
| 39 | |||
| 40 | $method = Injector::inst()->get($method); |
||
| 41 | |||
| 42 | if (!$method) { |
||
| 43 | throw new UnexpectedValueException(sprintf( |
||
| 44 | 'Given method "%s" does not exist/can not be resolved with Injector', |
||
| 45 | $method |
||
| 46 | )); |
||
| 47 | } |
||
| 48 | |||
| 49 | if (!$method instanceof MethodInterface) { |
||
| 50 | throw new UnexpectedValueException(sprintf( |
||
| 51 | 'Given method "%s" does not implement %s', |
||
| 52 | $method, |
||
| 53 | MethodInterface::class |
||
| 54 | )); |
||
| 55 | } |
||
| 56 | |||
| 57 | $allMethods[] = $method; |
||
| 58 | } |
||
| 59 | |||
| 60 | return $allMethods; |
||
| 61 | } |
||
| 63 |