| Conditions | 2 |
| Paths | 2 |
| Total Lines | 40 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 1 | public function dump(MethodCollection $collection, array $options) |
|
| 14 | { |
||
| 15 | $content = |
||
| 16 | <<<CONTENT |
||
| 17 | <?php |
||
| 18 | |||
| 19 | use Bankiru\Api\Rpc\Routing\Exception\MethodNotFoundException; |
||
| 20 | use Bankiru\Api\Rpc\Routing\MethodMatcher; |
||
| 21 | |||
| 22 | 1 | final class {$options['class']} implements MethodMatcher |
|
| 23 | { |
||
| 24 | /** {@inheritdoc} */ |
||
| 25 | public function match(\$method) |
||
| 26 | { |
||
| 27 | 1 | \$routes = [ |
|
| 28 | 1 | CONTENT; |
|
| 29 | |||
| 30 | 1 | foreach ($collection->all() as $name => $method) { |
|
| 31 | 1 | $ret = var_export(AttributesHelper::getAttributes($method, $name), true); |
|
| 32 | 1 | $content .= PHP_EOL . |
|
| 33 | <<<CONTENT |
||
| 34 | 1 | '{$method->getMethod()}' => {$ret}, |
|
| 35 | 1 | CONTENT; |
|
| 36 | 1 | } |
|
| 37 | |||
| 38 | $content .= |
||
| 39 | <<<CONTENT |
||
| 40 | ]; |
||
| 41 | |||
| 42 | if (array_key_exists(\$method, \$routes)) { |
||
| 43 | return \$routes[\$method]; |
||
| 44 | } |
||
| 45 | |||
| 46 | throw new MethodNotFoundException(\$method); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | 1 | CONTENT; |
|
| 50 | |||
| 51 | 1 | return $content; |
|
| 52 | } |
||
| 53 | } |
||
| 54 |