Checks existence and returns the value of the key
@param array $array
@param string $key
@return array
172276
protected function find($array, $key)
    {
        if (empty($key) && !is_numeric($key) || empty($array) || !is_array($array)) {
            return [false, null];
        }

        $partsOfKey = explode('.', $key);
        $variants = [];
        $parts = [];

        do {
            $partial = implode('.', $partsOfKey);

            if (array_key_exists($partial, $array)) {
                if (!count($parts)) {
                    return [true, $array[$partial]];
                }

                $variants[implode('.', $parts)] = $array[$partial];
            }

            array_unshift($parts, array_pop($partsOfKey));
        } while (count($partsOfKey));

        foreach ($variants as $path => $branch) {
            list($has, $value) = $this->find($branch, $path);

            if ($has) {
                return [true, $value];
            }
        }

        return [false, null];
    }
239692
private function getArrayValue(array $array)
    {
        $value = [];
        foreach ($array as $item) {
            if ($item instanceof Keyword) {
                $item = $this->getKeyword($item);
            }
            $value[] = trim(str_replace(array("\n", "\r"), '', strip_tags('' . $item)));
        }

        array_walk($value, function(&$item) { return trim(str_replace(array("\n", "\r"), '', strip_tags('' . $item))); });

        return implode(',', array_filter($value));
    }
1145597
protected function find(array $array, string $key)
    {
        $item = $array;

        foreach (explode('.', $key) as $segment) {
            if (is_array($item) && array_key_exists($segment, $item)) {
                $item = $item[$segment];
            } else {
                throw new \Exception();
            }
        }

        $this->cache[$key] = &$item;

        return $item;
    }
409768
public static function exists(array $array, $key)
    {
        //
        if (array_key_exists($key, $array)) {
            return true;
        }
        //
        $keys = dot($key);
        //
        foreach ($keys as $key) {
            if (array_key_exists($key, $array)) {
                $array = (array) $array[$key];
                continue;
            } else {
                return false;
            }
        }
        //
        return true;
    }
660551
private function narrowArray(array $array, string $key = null)
    {
        if ($key) {
            $key .= '--';
        }

        $result = [];

        foreach ($array as $index => $value) {
            if (is_array($value)) {
                $result = array_merge($result, $this->narrowArray($value, $key . $index));
            } else {
                $result[$key . $index] = $value;
            }
        }

        return $result;
    }
1041063
public static function findByKey($array, $key, $value) {
        foreach ($array as $element)
            if (call_user_func(array($element, $key)) === $value)
                return $element;
        return null;
    }
515020
public static function hasKey(Array $array, Array $keys)
    {
        foreach ($array as $key => $value) {
            if (in_array($key, $keys)) {
                return true;
            }
        }

        return false;
    }
1332096
public static function get(array $array, ...$keys)
    {
        $key = array_shift($keys);

        if (!isset($array[$key])) {
            return null;
        }

        if (empty($keys)) {
            return $array[$key] ?? null;
        }

        if (!\is_array($array[$key])) {
            return null;
        }

        return self::get($array[$key], ...$keys);
    }
882136
public static function GetElementsByKeys (array $array, array $keys) {
		return array_filter(array_combine($keys, array_map(function ($key) use ($array) {
			return isset($array[$key]) ? $array[$key] : null;
		}, $keys)));
	}
164039
public function getArray($key)
	{
		$this->validateKey($key);
		return $this->has($key) ? $this->params[$key] : [];
	}
1051906
public static function delete(&$array, $key)
	{
		if (is_null($key))
		{
			return false;
		}

		if (is_array($key))
		{
			$return = array();
			foreach ($key as $k)
			{
				$return[$k] = static::delete($array, $k);
			}
			return $return;
		}

		$key_parts = explode('.', $key);

		if (! is_array($array) or ! array_key_exists($key_parts[0], $array))
		{
			return false;
		}

		$this_key = array_shift($key_parts);

		if (! empty($key_parts))
		{
			$key = implode('.', $key_parts);
			return static::delete($array[$this_key], $key);
		}
		else
		{
			unset($array[$this_key]);
		}

		return true;
	}
393756
public static function get($array, $key = null, $default = null, $opr = null)
    {
        if (!self::isReallyArray($array)) {
            return $default;
        }
        if (null === $key) {
            return $array;
        }
        if (array_key_exists($key, $array)) {
            return $array[$key];
        }

        if (null !== $opr) {
            if (strpos($key, $opr) === false) {
                return $array[$key] ?? $default;
            }

            foreach (explode($opr, $key) as $k) {
                if (self::isReallyArray($array) && array_key_exists($k, $array)) {
                    $array = $array[$k];
                } else {
                    return $default;
                }
            }

            return $array;
        }

        return $default;
    }
1271414
protected static function arrayGet(array $array, $key)
    {
        $key = strtolower($key);
        $array = array_change_key_case($array, CASE_LOWER);

        if (!array_key_exists($key, $array)) {
            throw new TokenException(
                sprintf('Did not find key %s in array: %s', json_encode($key), json_encode($array))
            );
        }

        return $array[$key];
    }
789321
public static function has( $array, $key )
	{
		if ( !$array )
			return false;

		if ( is_null( $key ) )
			return false;

		if ( static::exists( $array, $key ) )
			return true;

		foreach ( explode( '.', $key ) as $segment )
			if ( static::accessible( $array ) && static::exists( $array, $segment ) )
				$array = $array[$segment];
			else
				return false;

		return true;
	}
329772
public function flatAssocArray(array $array)
	{
		$ret = [];
		foreach ($array as $key => $value) {
			if (is_array($value)) {
				$ret += $this->flatAssocArray($value);
			}
			else {
				$ret[ $key ] = $value;
			}
		}

		return $ret;
	}
1020151
public static function has($array, $keys)
	{
		if(is_null($keys) || ! $array)
		{
			return false;
		}

		$keys = (array) $keys;
		if($keys === [])
		{
			return false;
		}

		foreach($keys as $key)
		{
			if(static::exists($array, $key))
			{
				continue;
			}

			if( strpos($key, ".") !== false )
			{
				$subKeyArray = $array;
				for($i = 0, $map = explode('.', $key), $len = count($map); $i < $len; $i++)
				{
					$segment = $map[$i];
					if( ($i < 1 || static::accessible($subKeyArray)) && static::exists($subKeyArray, $segment) )
					{
						if( $i + 1 < $len )
						{
							$subKeyArray = $subKeyArray[$segment];
						}
					}
					else
					{
						return false;
					}
				}
			}
		}

		return true;
	}
70213
private function getArray(Array_ $array)
    {
        $return = [];

        foreach ($array->items as $item) {
            if ($item->key === null) {
                $return[] = $this->getValue($item->value);
            } else {
                $return[$this->getValue($item->key)] = $this->getValue($item->value);
            }
        }

        return $return;
    }