| Conditions | 4 |
| Paths | 8 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.1755 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 1 | public function visit(AbstractField $field) { |
|
| 21 | 1 | $cost = $field->getConfig()->get('cost'); |
|
| 22 | 1 | if (is_callable($cost)) { |
|
| 23 | $cost = $cost(); |
||
| 24 | } |
||
| 25 | 1 | $this->memo += $cost ?: $this->defaultScore; |
|
| 26 | 1 | if ($this->memo > $this->maxScore) { |
|
| 27 | 1 | throw new \Exception('query exceeded max allowed complexity of ' . $this->maxScore); |
|
| 28 | } |
||
| 29 | 1 | return $this->memo; |
|
| 30 | } |
||
| 31 | } |