Validates that the field key is not reserved.

@param   string  $key
@throws  MetadataException
779164
protected function validateKey($key)
    {
        $reserved = ['type', 'id'];
        if (in_array(strtolower($key), $reserved)) {
            throw MetadataException::reservedFieldKey($key, $reserved);
        }
    }
805728
protected function addKey(string $key) : void
    {
        if (!$this->keyStore->isValidKey($key)) {
            throw new DumpException("The key \"{$key}\" has already been defined previously.");
        }

        $this->keyStore->addKey($key);
    }
147562
public function getMetadata($key)
    {
        if (!is_array($this->metadata)) {
            $this->metadata = json_decode(json_encode($this->metadata), true);
        }
        return (isset($this->metadata[$key])) ? $this->metadata[$key] : null;
    }
220888
protected function isNullableKey($key)
    {
        if ( ! array_key_exists($key, $this->info->attributes)) {
            throw new RuntimeException(
                "Foreign key '{$key}' defined for relation does not exist on model " . get_class($this->model())
            );
        }

        return (bool) $this->info->attributes[ $key ]->nullable;
    }
1331034
public function forgetMetaData($key): void
    {
        $meta = $this->getAttribute('meta');

        if (\is_array($key)) {
            foreach ($key as $name) {
                $meta->forget($name);
            }
        } else {
            $meta->forget($key);
        }

        $this->setMetaAttribute($meta);
    }
1206289
public function offsetGet($key)
    {
        assert(
            is_string($key),
            sprintf('Invalid metadata key: (%s) %s', gettype($key), VarPrinter::toString($key))
        );

        return $this->get($key);
    }
1026630
protected function validateEncryptionKey($key)
	{
		if(is_string($key))
		{
			$cryptAlgorithm = is_array($this->cryptAlgorithm) ? $this->cryptAlgorithm[0] : $this->cryptAlgorithm;

			$supportedKeyLengths=@mcrypt_module_get_supported_key_sizes($cryptAlgorithm);

			if($supportedKeyLengths)
			{
				if(!in_array($this->strlen($key),$supportedKeyLengths)) {
					throw new CException(Yii::t('yii','Encryption key length can be {keyLengths}.',array('{keyLengths}'=>implode(',',$supportedKeyLengths))));
				}
			}
			elseif(isset(self::$encryptionKeyMinimumLengths[$cryptAlgorithm]))
			{
				$minLength=self::$encryptionKeyMinimumLengths[$cryptAlgorithm];
				$maxLength=@mcrypt_module_get_algo_key_size($cryptAlgorithm);
				if($this->strlen($key)<$minLength || $this->strlen($key)>$maxLength)
					throw new CException(Yii::t('yii','Encryption key length must be between {minLength} and {maxLength}.',array('{minLength}'=>$minLength,'{maxLength}'=>$maxLength)));
			}
			else
				throw new CException(Yii::t('yii','Failed to validate key. Supported key lengths of cipher not known.'));
		}
		else
			throw new CException(Yii::t('yii','Encryption key should be a string.'));
	}
796713
private static void validate(@NotNull EntityMetadata entityMetadata) {
        if (StringUtils.isEmpty(entityMetadata.getTableName())) {
            throw new MetadataException(String.format("Invalid table name: \"%s\"", entityMetadata.getTableName()));
        }

        if (entityMetadata.getPartitionKeySize() < 1) {
            throw new MetadataException(String.format("Entity \"%s\"must contains primary key", entityMetadata.getTableName()));
        }
    }
41624
public static function isValidKey($key) {
        if(!is_string($key)) {
            throw EnumerationException::invalidKeyType(gettype($key));
        }

        return array_key_exists($key, self::toArray());
    }
381503
protected function guardAgainstNonTranslatableAttribute($key)
    {
        if ( ! $this->isTranslatableAttribute($key)) {
            throw UntranslatableAttributeException::make($key, $this->getTranslatableAttributes());
        }
    }
498096
protected function parseKey($key)
    {
        if (substr_count($key, $this->getDelimiter()) != 4)
        {
            throw new InvalidKeyException('Invalid file key: '.$key);
        }
        
        $this->key = $key;
        
        list($storageName, $className, $fieldName, $depth, $hashExt) = explode($this->getDelimiter(), $key);
        
        if (false !== strpos($hashExt, '.'))
        {
            list($hash, $extension) = explode('.', $hashExt, 2);
        }
        else
        {
            $hash = $hashExt;
            $extension = '';
        }
        
        $this->storageName = $storageName;
        $this->className = $className;
        $this->fieldName = $fieldName;
        $this->depth = $depth;
        $this->hash = $hash;
        $this->extension = $extension;
        
        return $this;
    }
137237
public static function validateSSL(string $data, XMLSecurityKey $key) : void
    {
        $container = ContainerSingleton::getInstance();
        $keyInfo = openssl_pkey_get_details($key->key);
        if ($keyInfo === false) {
            throw new \Exception('Unable to get key details from XMLSecurityKey.');
        }

        if (!isset($keyInfo['key'])) {
            throw new \Exception('Missing key in public key details.');
        }

        if ($keyInfo['key'] !== $data) {
            $container->getLogger()->debug('Key on SSL connection did not match key we validated against.');

            return;
        }

        $container->getLogger()->debug('Message validated based on SSL certificate.');
    }
261562
private function validateKey($key) : bool {
        if (!hash_equals($this->appKey, $key)) {
            throw new \Nuki\Exceptions\Base('Used key does not equal the known application key');
        }
        
        return true;
    }
1149357
public function delete_meta( $key )
	{
		if ( ! $this->has_meta( $key ) ) return;

		delete_post_meta( $this->attributes['ID'], $key );

		unset( $this->meta[$key] );
	}
1071515
protected function assertInitiated($key) {
        $current = &$this->query;
        $keys = explode(".", $key);
        foreach ($keys as $element) {
            if (!array_key_exists($element, $current)) {
                $current[$element] = [];
            }
            $current = &$current[$element];
        }
    }
63977
public function protect($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);
        }

        $this->_protected[$key] = true;
    }
1223984
public function isValid($key = null)
    {
        if (parent::isValid()) {
            if ($key && parent::getKey() && parent::getKey() == $key) {
                return true;
            }
        }

        return false;
    }