| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public static function createFromResource($resource): ResourceDecoratorInterface |
||
| 20 | { |
||
| 21 | $type = $resource->model_type ?? $resource->type; |
||
| 22 | $map = static::typeMap(); |
||
| 23 | |||
| 24 | if (!isset($map[$type])) { |
||
| 25 | throw new InvalidConfigException('No representative decoration class found for type "' . $type . '"'); |
||
| 26 | } |
||
| 27 | |||
| 28 | return new $map[$type]($resource); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |