Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 3 | public function create(string $strategyId, string $strategyType, ?Segments $segments = null): ToggleStrategy |
|
15 | { |
||
16 | 3 | $segments = $segments ?? new Segments(); |
|
17 | 3 | if (EnableByMatchingSegment::NAME === $strategyType) { |
|
18 | 1 | return new EnableByMatchingSegment($strategyId, $segments); |
|
19 | } |
||
20 | 2 | if (EnableByMatchingIdentityId::NAME === $strategyType) { |
|
21 | 1 | return new EnableByMatchingIdentityId($strategyId, $segments); |
|
22 | } |
||
23 | |||
24 | 1 | throw InvalidStrategyTypeGiven::withType($strategyType); |
|
25 | } |
||
35 |