Parse existing key and split it into its parts.

@param string $key
@throws InvalidKeyException

@return FileKey
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;
    }
348802
private function parseRaw($key)
    {
        $key = str_replace('[]', '', $key);
        parse_str($key, $levels);
        if (is_null($levels)) {
            return null;
        }
        $inputs = $this->data;
        return $this->recurseGet($levels, $inputs);
    }
1190924
public static function get(string $key)
    {
        if (!in_array($key, self::$allowedKeys) || !isset(self::$storedValues[$key])) {
            throw new \InvalidArgumentException('Invalid key given');
        }

        return self::$storedValues[$key];
    }
1188536
public function get(?string $key = null)
    {
        $key = $this->constructKey($key);

        if (is_null($key)) {
            $array = $this->toArray();

            return $this->count() == 1 ? end($array) : $array;
        }

        return $this->parseKey($key, function ($part, $result) {
            if (isset($result[$part])) {
                return $result[$part];
            }
        });
    }
835673
protected function file($key)
    {
        return $this->dir . DIRECTORY_SEPARATOR . $this->key($key) . "." . $this->fileExtension;
    }
987037
public function getFilename(string $key): string
    {
        if (!$this->validate($key)) {
            throw new \InvalidArgumentException('The key provided (' . $key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".');
        }
        if ($this->filenameProtocol === null) {
            throw new \Exception('No filenameProtocol specified!');
        }
        return $this->filenameProtocol . '://' . $key;
    }
1075976
protected function parseKey($key)
    {
        if (0 === strpos($key, '__TABLE__.')) {
            $tmp = explode('.', $key, 2);
            $key = isset($tmp[1]) ? $tmp[1] : null;
        }
        if ('id' == $key && $this->connection->getConfig('pk_convert_id')) {
            $key = '_id';
        }
        return trim($key);
    }
108315
private function checkAndTransformKey($key, $node)
    {
        if ('-' === $key || ($this->isIntegerKey($key) && (!is_array($node) || count($node)))) {
            if (!is_array($node) || $this->isAssociativeArray($node)) {
                throw new InvalidPathException(
                    sprintf('Used "%s" but array was not an array or is associative.', $key)
                );
            }
            $key = '-' === $key ? count($node) : (int) $key;
        }

        return $key;
    }
990720
public function parseKey($key)
    {
        $keys = explode('.', $key);

        $keys = [implode(".", array_slice($keys, 0, -1)), $keys[count($keys) - 1]];

        $key = (new Collection($keys))->map(function ($part) {
            return '`'.$part.'`';
        })->implode('.');

        return DB::raw($key);
    }
321616
public function setKey($key)
    {
        try {
            $this->blockCipher->setKey($key);
        } catch (CryptException\InvalidArgumentException $e) {
            throw new Exception\InvalidArgumentException($e->getMessage());
        }
        $this->encryption['key'] = $key;
        return $this;
    }
1190109
public function parseKey($key)
    {
        $keys = explode('.', $key);

        if (count($keys) === 1) {
            $keys = [$this->getManager()->getRepository()->newEntity()->getTable(), $keys[0]];
        }

        return DB::raw('`'.implode('.', array_slice($keys, 0, -1)).'`.'.$keys[count($keys) - 1]);
    }
990052
public function getOrFail($key)
    {
        if (!ArrayUtility::dotExists($this->data, $this->getNormalizedKey($key))) {
            throw new InvalidPropertyException("Missing property '$key'");
        }

        return $this->get($key);
    }
897531
public function get( $key ) {

		if ( $this->has( $key ) ) {
			return $this->container[strtolower( $key )];
		}

		throw new InvalidArgumentException( "{$key} is unknown" );
	}
228102
public function pathValue($key)
    {
        if (!isset($this->keyToIndexMap[$key]) || !$this->values[$this->keyToIndexMap[$key]] instanceof Path) {
            throw new \InvalidArgumentException(sprintf('value for %s is not of type %s', $key, 'PATH'));
        }

        return $this->value($key);
    }
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;
    }
456873
private function getFilePath($key)
    {
        if (!preg_match('|^[a-zA-Z0-9_\.! ]+$|', $key)) {
            throw new InvalidArgumentException(sprintf('Invalid key "%s". Valid filenames must match [a-zA-Z0-9_\.! ].', $key));
        }

        return sprintf('%s/%s', $this->folder, $key);
    }
752032
protected function _normalizeKey($key)
    {
        try {
            return $this->_normalizeString($key);
        } catch (InvalidArgumentException $e) {
            throw $this->_createOutOfRangeException($this->__('Invalid key'), null, $e, $key);
        }
    }