| Conditions | 5 |
| Paths | 2 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | static public function create(EntityContainerBuilder $builder, $type) |
||
| 10 | { |
||
| 11 | //TODO 支持|分隔的多类型 |
||
| 12 | |||
| 13 | 10 | $getter = function($type)use($builder){ |
|
| 14 | 10 | if(!$type || $type == 'mixed'){ |
|
| 15 | 4 | return new MixedTypeContainer(); |
|
| 16 | 10 | }elseif (TypeHint::isScalarType($type)){ |
|
| 17 | 8 | return new ScalarTypeContainer($type); |
|
| 18 | }else{ |
||
| 19 | 4 | return $builder->build($type); |
|
| 20 | } |
||
| 21 | 10 | }; |
|
| 22 | 10 | if(TypeHint::isArray($type)){ |
|
| 23 | 6 | $container = ArrayContainer::create($type, $getter); |
|
| 24 | 6 | }else{ |
|
| 25 | 8 | $container = $getter($type); |
|
| 26 | } |
||
| 27 | 10 | return $container; |
|
| 28 | } |
||
| 29 | } |