| Conditions | 4 |
| Paths | 8 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.0218 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | 1 | public function visit(array $args, FieldConfig $fieldConfig, $childScore = 0) { |
|
| 29 | 1 | $cost = $fieldConfig->get('cost'); |
|
| 30 | 1 | if (is_callable($cost)) { |
|
| 31 | $cost = $cost($args, $fieldConfig, $childScore); |
||
| 32 | } |
||
| 33 | 1 | $cost = $cost ?: $this->defaultScore; |
|
| 34 | 1 | $this->memo += $cost; |
|
| 35 | 1 | if ($this->memo > $this->maxScore) { |
|
| 36 | 1 | throw new \Exception('query exceeded max allowed complexity of ' . $this->maxScore); |
|
| 37 | } |
||
| 38 | 1 | return $cost; |
|
| 39 | } |
||
| 40 | } |