| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 2 | public function create(string ...$acceptableFormats): FormatterInterface |
|
| 33 | { |
||
| 34 | 2 | foreach ($acceptableFormats as $format) { |
|
| 35 | 2 | if (true === array_key_exists($format, $this->formatters)) { |
|
| 36 | 1 | return new $this->formatters[$format]; |
|
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | 1 | throw new NotAcceptableHttpException( |
|
| 41 | sprintf( |
||
| 42 | 1 | 'Unable to provide an acceptable representation. Available alternatives: %s.', |
|
| 43 | 1 | implode(', ', array_keys($this->formatters)) |
|
| 44 | ) |
||
| 56 |