Returns a parameter value in the specified array, if not in, returns the
first element instead

@param string $name The parameter name
@param array $array The array to be search
@return mixed The parameter value
33
public function getInArray($name, array $array)
    {
        $value = $this->get($name);
        return in_array($value, $array) ? $value : $array[key($array)];
    }
1151387
protected function findInputValueByName( $name, $inputArray )
    {
        foreach($inputArray as $key=>$value){
            if($key === $name) { // use === because plain == allowed numeric indexes to be equal to names
                return $value;
            }
            if (is_array($value)) {
                if (($result = $this->findInputValueByName($name,$value)) !== false) {
                    return $result;
                }
            }
        }

        return false;
    }
1229217
public function getGet($name){

		//check if null param supplied and return the while GET array
		if($name === null){

			//return the whole array
			return $this->getInputData;

		}

		//check for named paramter
		elseif ($this->KeyExists($name, $this->getInputData)) {
			
			//return the value of this key
			return htmlentities($this->getInputData[$name], ENT_QUOTES);

		}

		//this key does not exists, return bool false
		else{

			//return bool false
			return false;

		}

	}
1129522
public static function getMaxValueLength(array $array)
    {
        $maxValueLength = '0';
        foreach ($array as $value) {
            $currentLength = static::getVisibleStringLength($value);

            if ($currentLength > $maxValueLength) {
                $maxValueLength = $currentLength;
            }
        }

        return $maxValueLength;
    }
115904
public function &__get($name)
    {
        // This method must return a reference and not use ternary operators for __set()ing multi-dimensional arrays
        // http://stackoverflow.com/questions/4310473/using-set-with-arrays-solved-but-why
        // http://stackoverflow.com/questions/5966918/return-null-by-reference-via-get
        switch ($name) {
            case 'global':
                if (is_null(static::$global)) {
                    static::$global = new Container;
                }

                return static::$global;
                break;
            case 'session':
                if (is_null(static::$session)) {
                    static::$session = new Session;
                }

                return static::$session;
                break;
            case 'request':
            case 'dir':
            case 'url':
            case 'html':
                return $this->$name;
                break;
            default:
                return $this->html[strtolower($name)];
                break;
        }
    }
1101780
public static function get(array $array, string $path)
    {
        $paths = explode('.', $path);
        $temp = $array;
        while ($key = array_shift($paths)) {
            if (isset($temp[$key])) {
                $temp = $temp[$key];
            } else {
                return null;
            }
        }
        return $temp;
    }
1074581
public static function get(array $array, $key = null, $default = null)
    {
        if ($key === null) {
            return $array;
        }

        if (isset($array[$key])) {
            return static::value($array[$key]);
        }

        foreach (explode('.', (string) $key) as $segment) {
            if (! array_key_exists($segment, $array)) {
                return static::value($default);
            }

            $array = $array[$segment];
        }

        return $array;
    }
758647
public function getParameter($name): ?Parameter
    {
        /** @var Parameter $parameter */
        foreach ($this->parameters as $parameter) {
            if ($parameter->getKey() === $name) {
                return $parameter;
            }
        }

        return null;
    }
877782
public static function indexOf(array $array, string $value, ?string $key = null)
    {
        foreach ($array as $index => $item) {
            if ($key !== null) {
                if (is_object($item)) {
                    $checkValue = isset($item->{$key}) ? $item->{$key} : null;
                } else {
                    $checkValue = isset($item[$key]) ? $item[$key] : null;
                }
            } else {
                $checkValue = $item;
            }
            if ($checkValue !== null && $checkValue === $value) {
                return $index;
            }
        }
        return -1;
    }
116100
public static function get(array $array, string $key = null, $default = null)
    {
        if ($key === null) {
            return $array;
        }

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

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

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

        return $array;
    }
323753
public function param($name)
    {
        $params = $this->params();
        if (isset($params[$name])) {
            return $params[$name];
        } else {
            return null;
        }
    }
1102361
public static function getParam($name)
    {
        if ($param = static::getCont()->hasParameter($name)) {
            return static::getCont()->getParameter($name);
        }

        if (strpos($name, '.') !== false) {
            $parts = explode('.', $name, 2);
            $data = static::getCont()->getParameter($parts[0]);
            $data = UtilArray::cascadeGet($data, $parts[1]);
            if ($data) {
                return $data;
            }
        }

        return static::getCont()->getParameter($name);
    }
1141625
public static function SortLowest ($array, $name) {
		uasort(
			$array,
			function ($current, $next) use ($name) {
				return strnatcmp(static::GetLowest($current, $name), static::GetLowest($next, $name));
			}
		);
		return $array;
	}
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);
    }
210299
public static function first($array, $callback, $default = null)
    {
        foreach ($array as $key => $value) {
            if (call_user_func($callback, $key, $value)) {
                return $value;
            }
        }

        return $default;
    }
171384
public static function get(array $array, $key = null, $default = null)
    {
        if (is_null($key)) {
            return;
        }

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

        foreach (explode('.', $key) as $token) {
            if (! is_array($array) or ! array_key_exists($token, $array)) {
                return $default;
            }

            $array = $array[$token];
        }

        return $array;
    }
582686
public static function arrayGet(array $array, $key, $default = null)
    {
        if (isset($array[$key])) {
            return $array[$key];
        }

        foreach (explode('.', $key) as $segment) {
            if (!is_array($array) || !array_key_exists($segment, $array)) {
                return $default;
            }

            $array = $array[$segment];
        }

        return $array;
    }