Get a single value from an array-tree.

@param   array     $values   Ex: ['foo' => ['bar' => 123]].
@param   array     $path     Ex: ['foo', 'bar'].
@param   mixed     $default
@return  mixed               Ex 123.

@access  public
@static
507152
static function pathGet($values, $path, $default = NULL) {
        foreach ($path as $key) {
            if (!is_array($values) || !isset($values[$key])) {
                return $default;
            }
            $values = $values[$key];
        }
        return $values;
    }
697047
public function value($root, $path)
    {
        if (!is_array($root) && !is_object($root)) {
            return null;
        }

        if (!$this->isNestedKey($path)) {
            return $this->getNode($root, $path);
        }

        return $this->getNestedValue($root, $path);
    }
319335
protected function getValueForPath($path)
    {
        $data = $this->data;
        if (!$data) {
            return null;
        }

        $steps = $this->getPath($path);
        if (!$steps) {
            return null;
        }

        if (\is_array($steps)) {
            if (1 === \count($steps)) {
                return $this->getValue(current($steps), $data);
            }

            $value = [];
            foreach ($steps as $step) {
                $value[] = $this->getValue($step, $data);
            }

            return trim(implode(' ', $value)) ?: null;
        }

        return $this->getValue($steps, $data);
    }
392912
private function getValueByKey(array $data, $key, $default = null)
    {
        if (!is_string($key) || empty($key) || !count($data)) {
            return $default;
        }

        if (strpos($key, '.') !== false) {
            $keys = explode('.', $key);

            foreach ($keys as $innerKey) {
                if (!is_array($data) || !array_key_exists($innerKey, $data)) {
                    return $default;
                }

                $data = $data[$innerKey];
            }

            return $data;
        }

        return array_key_exists($key, $data) ? $data[$key] : $default;
    }
988778
public static function getByPath($subject, array $path, $default = null)
    {
        $ptr =& $subject;
        foreach ($path as $key) {
            if (is_object($ptr) && isset($ptr->$key)) {
                $ptr =& $ptr->$key;
            } elseif (is_array($ptr) && isset($ptr[$key])) {
                $ptr =& $ptr[$key];
            } else {
                return $default;
            }
        }
        return $ptr;
    }
1109011
public static function getValueOfArray(array $array, $key, $default = null)
    {
        if (null === $key) {
            return $array;
        }

        if (\array_key_exists($key, $array)) {
            return $array[$key];
        }

        if (!\strpos($key, '.')) {
            return $default;
        }

        foreach (\explode('.', $key) as $segment) {
            if (\is_array($array) && \array_key_exists($segment, $array)) {
                $array = $array[$segment];
            } else {
                return $default;
            }
        }

        return $array;
    }
708185
public function get($path, $default = NULL, $deep = FALSE) {

		return array_key_exists($path, $this->parameters) ? $this->parameters[$path] : $default;

	}
227014
public function get ($path) {
		list ($first, $rest) = self::getFirstAndRestPathElements($path);

		if (array_key_exists($first, $this -> data)) {
			$value = $this -> data[$first];
			if (is_null($rest)) {
				return $value;
			} else if ($value instanceof TreeInterface) {
				return $value -> get($rest);
			} else {
				throw new InvalidKeyException("Value at key `" . $first . "` is a scalar; cannot step further down the requested path `" . $rest . "`");
			}
		} else {
			throw new NonExistentKeyException("Key `" . $first . "` does not exist.");
		}
	}
390673
public function get($key, $default = null)
    {
        $values = parent::get(static::normalizeKey($key), $default);

        if (is_array($values) && count($values) === 1) {
            return $values[0];
        }
        return $values;
    }
875160
public static function extract($path, $items)
    {
        $paths = explode('.', $path);

        foreach ($paths as $value) {
            if (self::iterable($items) && array_key_exists($value, $items)) {
                $items = $items[$value];
            } else {
                return false;
            }
        }

        return $items;
    }
407510
public static function getValueFromXPath($path, \DOMXPath $xpath, \DomNode $context = null, $default = null)
    {
        $result = $xpath->query($path, $context);
        if (0 === $result->length) {
            return $default;
        }

        $item = $result->item(0);
        if (null === $item) {
            return $default;
        }

        return $item->nodeValue;
    }
1106058
public function get($path, $default=Null)
    {
        $current = $this->data;
        $p = strtok($path, '.');

        while ($p !== false) {
            if (!isset($current[$p])) {
                return is_null($default) ? $this->getDefault($path) : $default;
            }
            $current = $current[$p];
            $p = strtok('.');
        }

        return $current;
    }
712431
public function getValueByPath($path)
    {
        if (is_string($path)) {
            $path = $this->parsePath($path);
        }

        $child = $this->data;

        foreach ($path as $part) {
            if (isset($child[$part])) {
                $child = $child[$part];
            } else {
                return null;
            }
        }

        return $child;
    }
786878
protected function findValueInMultiArray(array $path, array $reference)
    {
        // Checks path existence
        if (
            count($path) == 0
            || !isset($reference[$path[0]])
        ) {
            throw new \OutOfRangeException();
        }

        $currentElement = $reference[$path[0]];

        if (!isset($path[1])) {
            return $currentElement;
        } else if (is_array($currentElement)) {
            return $this->findValueInMultiArray(array_slice($path, 1), $currentElement);
        } else {
            throw new \OutOfRangeException();
        }
    }
1083720
public function getValue(array $array, string $path)
    {
        // If the $path value is empty, return the entire array graph
        if ($this->isRoot($path)) {
            return $array;
        }

        // If $path doesn't exist returns null. It is not possible to distinghuish between a path that exists and has a
        // null value and a path that doesn't exist at all.
        return $this->pa->getValue($array, $path);
    }
255173
public function getObjectByPathOrDefault($path, array $defaultValue)
    {
        try {
            $object = $this->getObjectByPath($path);
        } catch (\InvalidArgumentException $e) {
            return $defaultValue;
        }

        if (!is_array($object)) {
            return $defaultValue;
        }

        return $object;
    }
1338299
public static function first($array, $path, $default = false){
        $data = self::get($array, $path, array());
        if(count($data) > 0)
            return reset($data);

        return $default;
    }