Retrieve the individual parts of a split value.

@param string  $key
@param integer $parts

@return string
@throws \RuntimeException
421044
private function getSplit($key, $parts)
    {
        $keys = array();
        for ($i = 0; $i < $parts; $i++) {
            $keys[] = $key.$i;
        }

        $values = $this->memcached->getMulti($keys);

        if (false === $values) {
            $msg = sprintf(
                'Unable to retrieve split key "%s": %s.',
                $key,
                $this->memcached->getResultMessage()
            );

            $this->getLogger()->log(LogLevel::NOTICE, $msg);
            throw new \RuntimeException($msg);
        }

        $value = implode('', $values);

        return $value;
    }
519465
public function searchPartByKeyAndType($key, $type = '\\Zepi\\Web\\UserInterface\\Layout\\AbstractContainer')
    {
        foreach ($this->parts as $part) {
            if ((is_a($part, $type) || is_subclass_of($part, $type)) && $part->getKey() === $key) {
                return $part;
            }
            
            $result = $part->searchPartByKeyAndType($key, $type);
            if ($result !== false) {
                return $result;
            }
        }
        
        return false;
    }
1236260
public function get(string $key): string
    {
        $key = $this->getKey($key);
        $value = $this->headers[$key] ?? "";
        return is_array($value) ? implode(", ", $value) : $value;
    }
125781
public static function get(array $nested, $key, $delimiter='.')
    {

        if (is_null($key)) return $nested;

        if (isset($nested[$key])) return $nested[$key];

        foreach (explode($delimiter, $key) as $segment) {
            if ( ! is_array($nested) || ! array_key_exists($segment, $nested))
            {
                return;
            }

            $nested = $nested[$segment];
        }

        return $nested;
    }
650115
public function retrieve(string $key)
    {
        $token = null;

        $storageInstance = $this->getRepository();

        $token = $storageInstance->{$key}?? null;

        return $token;
    }
551661
private function buildQuery($parts)
    {
        $return = array();
        foreach ($parts as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $v) {
                    $return[] = urlencode($key) . "=" . urlencode($v);
                }
                continue;
            }
            $return[] = urlencode($key) . "=" . urlencode($value);
        }
        return implode('&', $return);
    }
972782
final protected function getWithSeparator($key)
    {
        $structure = $this;
        $splitKeys = explode($this->separator, $key);
        foreach ($splitKeys as $key) {
            if (!isset($structure[$key])) {
                return null;
            }
            if (!is_array($structure[$key])) {
                return $structure[$key];
            }
            $structure = $structure[$key];
        }
        return $structure;
    }
36570
public function getSegment($key)
    {
        foreach ($this->getImporters() as $importer) {
            if ($importer->hasSegment($key)) {
                return $importer->getSegment($key);
            }
        }
        throw new \InvalidArgumentException(sprintf('Segment could not be found by key `%s`.', $key));
    }
285276
public function get($key)
    {
        if ($this->has($key)) {
            $flashMessages = $this->storage->get(self::FLASH_KEY);
            $message = $flashMessages[$key];

            $this->remove($key);

            if ($this->translator instanceof TranslatorInterface) {
                $message = $this->translator->translate($message);
            }

            return $message;
        } else {
            throw new RuntimeException(sprintf(
                'Attempted to read non-existing key %s', $key
            ));
        }
    }
453795
protected function processParts(array $parts)
    {
        $combined = new ArrayObject();
        $splitParts = new ArrayObject();
        $strCat = '';
        $strName = '';
        $parts[] = $this->partFactory->newToken(';');
        foreach ($parts as $part) {
            $pValue = $part->getValue();
            if ($part instanceof Token && $this->processTokenPart($pValue, $combined, $splitParts, $strName, $strCat)) {
                continue;
            }
            $strCat .= $pValue;
        }
        return $this->finalizeParameterParts($combined);
    }
993950
public function getFieldValues($key)
    {
        $values = array();
        $key = strtolower($key);

        foreach ($this->fields as $part => $value) {
            if (strtolower($part) === $key) {
                if (is_array($value)) {
                    foreach ($value as $v) {
                        $values []= $v;
                    }
                } else {
                    $values []= $value;
                }
            }
        }

        return $values;
    }
356500
protected function preparePartValue(string $key, $value)
    {
        if (! isset($this->partClassMap[$key])) {
            return $value;
        }

        $className = $this->partClassMap[$key];

        return ! $value instanceof $className ? new $className($value) : $value;
    }
702155
protected function splitNamespaceAndKey($key)
    {
        if (strpos($key, '::') !== false) {
            list($namespace, $key) = explode('::', $key, 2);

            return [$namespace, $key];
        }

        return ['', $key];
    }
88085
public function getPart($key)
    {
        foreach ($this->parts as $part) {
            if ($part->getKey() === $key) {
                return $part;
            }
        }
        
        return false;
    }
861057
private function createValueKey(string $part): array
    {
        $parts = explode('=', $part, 2);
        $key = trim($parts[0]);
        $value = isset($parts[1]) ? trim($parts[1]) : true;

        return [$key, $value];
    }
1041581
private function setSplit($key, $value)
    {
        $values = str_split($value, self::VALUE_SPLIT_SIZE);

        $to_set       = array();
        $to_set[$key] = self::VALUE_SPLIT.count($values);

        foreach ($values as $part_nr => $v) {
            $to_set[$key.$part_nr] = $v;
        }

        if (false === $this->memcached->setMulti($to_set)) {
            $msg = sprintf(
                'Unable to store split values for key "%s": %s.',
                $key,
                $this->memcached->getResultMessage()
            );

            $this->getLogger()->log(LogLevel::NOTICE, $msg);
            throw new \RuntimeException($msg);
        }

        return $value;
    }
1079768
public function get($key)
	{
		$file = $this->path($key);

		if (!file_exists($file))
		{
			return null;
		}

		$data = @unserialize(file_get_contents($file));

		if (!$data)
		{
			throw new RuntimeException('Cache file is invalid.');
		}

		if ($this->isDataExpired($data))
		{
			$this->forget($key);
			return null;
		}

		return $data['value'];
	}