| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 62 | public static function resolveTransformer($transformer) |
||
| 63 | { |
||
| 64 | if (is_callable($transformer)) { |
||
| 65 | return $transformer; |
||
| 66 | } |
||
| 67 | |||
| 68 | if (static::isTransformerClass($transformer)) { |
||
| 69 | return new $transformer(); |
||
| 70 | } |
||
| 71 | |||
| 72 | if (static::isTransformerClassArray($transformer)) { |
||
| 73 | /** @noinspection PhpIncompatibleReturnTypeInspection */ |
||
| 74 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
| 75 | return Craft::createObject($transformer); |
||
| 76 | } |
||
| 77 | |||
| 78 | return null; |
||
| 79 | } |
||
| 80 | } |
||
| 81 |