protected function getConfigValue($key, $defaultValue = null) { if (array_key_exists($key, $this->configCache)) { return $this->configCache[$key]; } $this->configCache[$key] = !empty($this->config) ? $this->config->get($key, $defaultValue) : $defaultValue; return $this->configCache[$key]; }
/** * {@inheritdoc} */ public function visit(array $args, FieldConfig $fieldConfig, $childScore = 0) { $cost = $fieldConfig->get('cost'); if (is_callable($cost)) { $cost = $cost($args, $fieldConfig, $childScore); } $cost = $cost ?: $this->defaultScore; $this->memo += $cost; if ($this->memo > $this->maxScore) { throw new \Exception('query exceeded max allowed complexity of ' . $this->maxScore); } return $cost; }