Generates a safe key, taking account of the configured key prefix

@param string $key the key passed over
@return mixed string $key or false
@throws \InvalidArgumentException If key's value is empty
337486
protected function _key($key)
    {
        $key = $this->key($key);
        if ($key === false) {
            throw new InvalidArgumentException('An empty value is not valid as a cache key');
        }

        return $this->_config['prefix'] . $key;
    }
1006334
public function normalizeKey($key)
	{
		$normalizedKey = filter_var(
			(preg_match('(^-\\d+$)D', $key)) ? count($this->items) + $key : $key,
			FILTER_VALIDATE_INT,
			[
				'options' => [
					'min_range' => 0,
					'max_range' => count($this->items)
				]
			]
		);

		if ($normalizedKey === false)
		{
			throw new InvalidArgumentException("Invalid offset '" . $key . "'");
		}

		return $normalizedKey;
	}
155539
public function translate($key)
    {
        // inproper param given
        if (!is_string($key) && !is_int($key)) {
            throw new \InvalidArgumentException("Invalid argument provided, string required!");

        // value provided not found in dictionary -> return it with slug
        // converted to a space
        } elseif (!array_key_exists($key, $this->dictionary)) {
            return preg_replace('/\\' . $this->config->value('slug_separator') . '/', ' ', $key);

        } else {

            // return with the translated value
            return $this->dictionary[$key];
        }
    }
575663
public function get(string $key)
    {
        if (!$this->has($key)) {
            throw new \InvalidArgumentException(\sprintf('The value identified by "%s" does not exist.', $key));
        }

        return $this->values[$key];
    }
81834
public function get(string $key)
    {
        if (!$this->has($key)) {
            throw new \InvalidArgumentException('Key "' . $key . '" does not exist.');
        }
        return $this->data[$key];
    }
82704
public static function extendedKeyBase58Decode($key)
    {
        // The base58-decoded extended key must consist of a serialized payload
        // plus an additional 4 bytes for the checksum.
        $decoded = static::base58()->decode($key);

        if (strlen($decoded) !== 82) {
            throw new \InvalidArgumentException('Wrong key length.');
        }

        // Split the payload and checksum up and ensure the checksum matches.
        $payload = substr($decoded, 0, 78);
        $expected = substr($decoded, -4);

        // Verify checksum of provided key
        $network = NetworkFactory::fromExtendedKeyVersion(substr($payload, 0, 4));
        $checksum = substr($network->base58Checksum($payload), 0, 4);

        if ($expected !== $checksum) {
            throw new \InvalidArgumentException('Wrong checksum on encoding extended key!');
        }

        return $decoded;
    }
743994
protected function buildKey($key)
    {
        return md5($this->prefix . (is_string($key) ? $key : json_encode($key)));
    }
1167931
private function parseKey($key)
    {
        if (!$key) {
            throw new InvalidArgumentException('string', 0, 'Cannot be null');
        }

        if (!is_string($key)) {
            throw new InvalidArgumentException('string', 0);
        }

        $arr = array(
            'prefix' => null,
        );

        $arr['identifier'] = $key;

        $pattern = '#^--|^-|^/#';
        if (preg_match($pattern, $key, $matches)) {
            $arr['prefix'] = $matches[0];
        }
        $arr['key'] = preg_replace($pattern, '', $key);

        return $arr;
    }
1085692
public static function validate(string $key, string $prefix): string
    {
        if (in_array($key, self::$keys)) {
            throw new InvalidArgumentException("The key [$key] is not unique.");
        }

        if (strpos($key, $prefix) === false) {
            throw new InvalidArgumentException("The key must be prefixed with [$prefix].");
        }

        return $key;
    }
1214596
public function keys(?string $key = null) : array
    {
        $value = $this->get($key);

        if (!is_array($value)) {
            throw new InvalidArgumentException(
                'method keys() should be called on array'
            );
        }

        return array_keys($value);
    }
983168
protected function getHelpValue($key)
    {
        if (!isset($this->helpValues[$key])) {
            throw new \InvalidArgumentException(sprintf('The required help value "%s" doesn\'t exist.', $key));
        }

        return $this->helpValues[$key];
    }
370306
public function destroy($key)
    {
        if (is_null($key)) {
            throw new \InvalidArgumentException('Empty key passed to Memcached::'.__FUNCTION__);
        }

        return $this->memcached()->delete($key);
    }
791847
public function getSharedProtectedHeaderParameter(string $key)
    {
        if ($this->hasSharedProtectedHeaderParameter($key)) {
            return $this->sharedProtectedHeader[$key];
        }

        throw new \InvalidArgumentException(\sprintf('The shared protected header "%s" does not exist.', $key));
    }
1126393
protected function getExpectedValue($key)
    {
        if (!isset($this->expectedValues[$key])) {
            throw new \InvalidArgumentException(sprintf('The required expected value "%s" doesn\'t exist.', $key));
        }

        return $this->expectedValues[$key];
    }
1293952
public function getParameter($key)
    {
        $key = strtoupper($key);

        if (! isset($this->upperParameters[$key])) {
            throw new \InvalidArgumentException('Parameter ' . $key . ' does not exist.');
        }

        return $this->upperParameters[$key];
    }
555903
protected function normalizeKey(&$key)
    {
        $key = (string)$key;

        if ($key === '') {
            throw new InvalidArgumentException("An empty key isn't allowed");
        } elseif (($p = $this->getOptions()->getKeyPattern()) && !preg_match($p, $key)) {
            throw new InvalidArgumentException(
                "The key '{$key}' doesn't match against pattern '{$p}'"
            );
        }
    }
328956
protected function getConfig($key = null)
    {
        if (!is_null($key)) {
            if (!array_key_exists($key, $this->config)) {
                throw new \InvalidArgumentException('Config key "'.$key.'" does not exist. Valid keys are: "'.implode(', ', array_keys($this->config)).'"');
            }

            return $this->config[$key];
        }

        return $this->config;
    }