Return a parameter or throw an exception if value is not declared.

@param $key

@throws CasException when $key is not a valid parameter

@return string
963056
private function getRouteParameter($key)
    {
        if (!key_exists('route', $this->configuration)) {
            throw new CasException('The route parameter must be defined. It is missing.');
        }

        if (!key_exists($key, $this->configuration['route'])) {
            throw new CasException(sprintf('The %s sub-parameter of route parameter must be defined. It is missing.', $key));
        }

        return $this->configuration['route'][$key];
    }
314938
private function getLogoutParameter($key)
    {
        if (!key_exists('logout', $this->configuration)) {
            throw new CasException('The logout parameter must be defined. It is missing.');
        }

        if (!key_exists($key, $this->configuration['logout'])) {
            throw new CasException(sprintf('The %s sub-parameter of logout parameter must be defined. It is missing.', $key));
        }

        return $this->configuration['logout'][$key];
    }
1082517
public function getDate($key)
    {
        try {
            $result = $this->get(self::DATE, $key);
            if (!$result instanceof DateTime) {
                return null;
            }
        } catch (\Exception $e) {
            return null;
        }
        return $result;
    }
596180
protected function makeKeyString($key): string {
        //convert numbers to strings.
        $stringValue = (string)$key;
        $length = strlen( $stringValue );
        if( $length == 0 ){
            throw new \Exception("Key values must be string values of at least 1 character. Empty strings cannot be used as indices in Binn format object containers." );
        }
        if( $length > 255 ){
            throw new \Exception("Unable to write this object in Binn Format. The Binn format OBJECT container is limited to string key lengths of 255 characters or less; one of the keys in this object violate this length rule.");
        }
        $byteSize = chr( $length );
        return $byteSize . $stringValue;
    }
1345298
protected function getParameter($key)
    {
        if (isset($this->parameters[$key])) {
            return $this->parameters[$key];
        }
        return false;
    }
1366879
public function getOption(string $key)
    {
        if (array_key_exists($key, $this->options)) {
            return $this->options[$key];
        }

        throw new Exception('Invalid option key "' . $key . '".', Exception::INVALID_OPTION);
    }
848923
public static function get($key) {
        if (!isset(self::$data[$key])) {
            throw new Exception("invalid config key");
        }

        return self::$data[$key];
    }
874484
public function get(string $key, bool $throwException = true)
    {
        if (!array_key_exists($key, $this->configData)) {
            if ($throwException) {
                throw new \InvalidArgumentException("Key \"{$key}\" not found in configuration with name \"{$this->instanceName}\"");
            }
            return null;
        }
        return $this->configData[$key];
    }
334236
public function getParam(string $key)
    {
        $isActionParam = in_array($key, [self::PARAM_CONTROLLER, self::PARAM_ACTION]);
        $params = $isActionParam ? $this->actionParams: $this->params;
        return array_key_exists($key, $params) ? $params[$key] : null;
    }
133134
protected function buildParameterPattern(string $key) : string
	{
		return '(' . str_replace('~', '\\~', $this->parameterPattern[$key] ?? self::ALLOWED_CHARS) . ')';
	}
299706
public function queryParameter($key)
    {
        $keys = array_pluck($this->queryParameters, 'key');
        $queryParameters = array_combine($keys, $this->queryParameters);
       
        return $queryParameters[$key];
    }
640718
public function get($key)
    {
        if (!is_string($key)) {
            throw new \InvalidArgumentException('Expected string as key');
        }

        if (isset($this->data[$key])) {
            return $this->data[$key];
        } elseif (!$this->isDataLoadedFromDb) {
            $stmt = $this->db->prepare(
                'SELECT * FROM ' . $this->name . ' WHERE ' . $this->keyColumnName
                . ' = :key;'
            );
            $stmt->bindParam(':key', $key, \PDO::PARAM_STR);
            $stmt->execute();

            if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
                $this->data[$row[0]] = $row[1];
                return $this->data[$key];
            }
        }

        return null;
    }
1207298
public function getRequired($key)
    {
        $value = $this->get($key);
        if (null !== $value) {
            return $value;
        }
        throw new KeyException("Required value not found: $key");
    }
921511
public function raw($key) {
        if (!is_string($key)) {
            throw new \Calf\Exception\InvalidArgument('Key must be string.');
        }

        if (!isset($this->_keys[$key])) {
            throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key);
        }

        return $this->_values[$key];
    }
1364046
public function getArgument($key)
    {
        if (! array_key_exists($key, $this->arguments)) {
            throw new ErrorException('Undefined index: '.$key);
        }

        return $this->arguments[$key];
    }
147759
public function get(string $key): string
    {
        if (!$this->users_id) {
            throw new Exception('No users is set to save config');
        }

        if ($config = $this->findFirst(['conditions' => 'users_id = ?0 and name = ?1', 'bind' => [$this->users_id, $key]])) {
            return $config->value;
        }

        throw new Exception('No value found for key: ' . $key);
    }
1191706
public function getString($key)
    {
        try {
            $result = $this->get(self::STRING, $key);
            if (!settype($result, 'string')) {
                return null;
            }
        } catch (\Exception $e) {
            return null;
        }
        return $result;
    }