| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function dispatch(Specification $specification): Criteria |
||
| 27 | { |
||
| 28 | switch (true) { |
||
| 29 | case ($specification instanceof AndSpecification): |
||
| 30 | return $this->walkAnd($specification); |
||
| 31 | case ($specification instanceof OrSpecification): |
||
| 32 | return $this->walkOr($specification); |
||
| 33 | case ($specification instanceof NotificationMetadataSpecification): |
||
| 34 | return $specification->criteria(); |
||
| 35 | default: |
||
| 36 | throw new \RuntimeException(); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: