Lines Matching defs:key
54 foreach ($config as $key => $value) {
55 $clientConfiguration->set($key, $value);
109 * Returns a specific config key or the whole config array if not set.
111 * @throws InvalidException if the given key is not found in the configuration
115 public function get(string $key)
117 if ('' === $key) {
121 if (!$this->has($key)) {
122 throw new InvalidException('Config key is not set: '.$key);
125 return $this->configuration[$key];
129 * Returns boolean indicates if configuration has key.
131 public function has(string $key): bool
133 return \array_key_exists($key, $this->configuration);
145 * @param string $key Key to set
148 public function set(string $key, $value): void
150 $this->configuration[$key] = $value;
154 * Add value to a key. If original value is not an array, value is wrapped.
156 * @param string $key Key to add
159 public function add(string $key, $value): void
161 if (!\array_key_exists($key, $this->configuration)) {
162 $this->configuration[$key] = [$value];
164 if (\is_array($this->configuration[$key])) {
165 $this->configuration[$key][] = $value;
167 $this->configuration[$key] = [$this->configuration[$key], $value];