| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 52 | public static function resolveTransformer($transformer) |
||
| 53 | { |
||
| 54 | if (is_callable($transformer)) { |
||
| 55 | return $transformer; |
||
| 56 | } |
||
| 57 | |||
| 58 | if (static::isTransformerClass($transformer)) { |
||
| 59 | return new $transformer(); |
||
| 60 | } |
||
| 61 | |||
| 62 | if (static::isTransformerClassArray($transformer)) { |
||
| 63 | /** @noinspection PhpIncompatibleReturnTypeInspection */ |
||
| 64 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
| 65 | return Craft::createObject($transformer); |
||
| 66 | } |
||
| 67 | |||
| 68 | return null; |
||
| 69 | } |
||
| 70 | } |
||
| 71 |