| Conditions | 4 |
| Paths | 8 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 2 | public function visit(array $args, FieldConfig $fieldConfig, $childScore = 0) { |
|
| 38 | 2 | $cost = $fieldConfig->get('cost'); |
|
| 39 | 2 | if (is_callable($cost)) { |
|
| 40 | 1 | $cost = $cost($args, $fieldConfig, $childScore); |
|
| 41 | 1 | } |
|
| 42 | 2 | $cost = $cost ?: $this->defaultScore; |
|
| 43 | 2 | $this->memo += $cost; |
|
| 44 | 2 | if ($this->memo > $this->maxScore) { |
|
| 45 | 1 | throw new \Exception('query exceeded max allowed complexity of ' . $this->maxScore); |
|
| 46 | } |
||
| 47 | 2 | return $cost; |
|
| 48 | } |
||
| 49 | } |