The view helper render function.

@param array $array The array
@param string $key The key
@return object|null The value for the key or null if the key does not exist
346257
public function render(array $array, string $key) {
    $result = null;

    if (is_array($array) && $key) {
      if (array_key_exists($key, $array)) {
        $result = $array[$key];
      }
    }

    return $result;
  }
220491
private function field($array, $prop = null) {
        if (is_string($array)) {
            $prop = $array;
            $array = $_POST;
        }

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

        return $array[$prop];
    }
1182294
public static function exists($array, $key)
    {
        $key = static::normalizeKey($key);

        if ($key === null || $key === '' || static::isEmpty($array))
        {
            return false;
        }

        $keys = explode('.', $key);
        $currentElement = $array;

        foreach ($keys as $currentKey)
        {
            if (!is_array($currentElement) || !array_key_exists($currentKey, $currentElement))
            {
                return false;
            }

            $currentElement = $currentElement[(string) $currentKey];
        }

        return true;
    }
521949
public static function get($array, $key, $default = null)
    {
        if (!is_array($array) and !$array instanceof ArrayAccess) {
            throw new InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
        }
        if (is_null($key)) {
            return $array;
        }
        if (is_array($key)) {
            $return = [];
            foreach ($key as $k) {
                $return[$k] = static::get($array, $k, $default);
            }
            return $return;
        }

        is_object($key) and $key = (string) $key;

        if (array_key_exists($key, $array)) {
            return $array[$key];
        }
        foreach (explode('.', $key) as $keyPart) {
            if (($array instanceof ArrayAccess and isset($array[$keyPart])) === false) {
                if (!is_array($array) or !array_key_exists($keyPart, $array)) {
                    return ($default instanceof Closure) ? $default() : $default;
                }
            }
            $array = $array[$keyPart];
        }
        return $array;
    }
432221
public static function pop(array $array, $key)
    {
        $keys = explode('.', $key);
        foreach($keys as $key) {
            if(!isset($array[$key])) {
                return null;
            }
            $array = $array[$key];
        }

        if(!is_array($array)) {
            return null;
        }

        return array_pop($array);
    }
1280760
public static function key_exists($array, $key)
    {
        if (!is_array($array) and !$array instanceof ArrayAccess) {
            throw new InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
        }

        is_object($key) and $key = (string) $key;

        if (!is_string($key)) {
            return false;
        }
        if (array_key_exists($key, $array)) {
            return true;
        }
        foreach (explode('.', $key) as $key_part) {
            if (($array instanceof ArrayAccess and isset($array[$key_part])) === false) {
                if (!is_array($array) or ! array_key_exists($key_part, $array)) {
                    return false;
                }
            }
            $array = $array[$key_part];
        }
        return true;
    }
461054
public static function isKeyWithElements($array, $key)
    {
        if (false === is_array($array) || false === isset($array[$key])) {
            return false;
        }

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

        if (0 === count($array[$key])) {
            return false;
        }

        return true;
    }
1341462
public function array_pluck( $array, $key, $default = null, $filter = false ) {
		$array = $this->get_array_value( $array );

		return array_map( function ( $d ) use ( $key, $default ) {
			is_object( $d ) and $d = (array) $d;

			return is_array( $d ) && array_key_exists( $key, $d ) ? $d[ $key ] : $default;
		}, $filter ? array_filter( $array, function ( $d ) use ( $key ) {
			is_object( $d ) and $d = (array) $d;

			return is_array( $d ) && array_key_exists( $key, $d );
		} ) : $array );
	}
1295212
public function getArrayValue(array $array, string $key)
    {
        foreach ($this->getBoth($key) as $loopKey) {
            if (array_key_exists($loopKey, $array)) {
                return $array[$loopKey];
            }
        }
    }
534859
public static function lists($array, $key)
    {
        $result = [];
        foreach ($array as $element) {
            $value = static::get($element, $key);
            $result[$value] = $element;
        }

        return $result;
    }
538472
protected function renderInput($key, array $input)
    {
        $html = '';
        switch ($input[ 'type' ]) {
            case 'label':
                $html .= $this->form_label($key);

                break;
            case 'legend':
                $html .= $this->form_legend($key);

                break;
            case 'select':
                $html .= $this->form_select($key);

                break;
            case 'textarea':
                $html .= $this->form_textarea($key);

                break;
            case 'group':
                $html .= $this->form_group($key);

                break;
            case 'html':
                $html .= $this->form_html($key);

                break;
            default:
                if (in_array($input[ 'type' ], $this->typeInputBasic)) {
                    $html .= $this->form_input($key);
                }
        }

        return $html;
    }
1172623
public static function drop(array &$array, $key)
    {
        $keys = explode('.', $key);
        $last = array_pop($keys);
        foreach($keys as $key) {
            if(!isset($array[$key])) {
                return false;
            }
            $array = &$array[$key];
        }

        if(isset($array[$last])) {
            unset($array[$last]);
            return true;
        }

        return false;
    }
1245975
protected function yamlArrayToModel($array)
    {
        $this->name = $this->getArrayKeySafe($array, 'name');
        $this->description = $this->getArrayKeySafe($array, 'description');
        $this->author = $this->getArrayKeySafe($array, 'author');
        $this->icon = $this->getArrayKeySafe($array, 'icon');
        $this->homepage = $this->getArrayKeySafe($array, 'homepage');
    }
909814
public function render($arrayVariable = null, $objectVariable = null, $keyVariable = null)
    {
        $formatter = $this->getFormatter();

        $arrayVariable = $arrayVariable ?: 'a';
        $objectVariable = $objectVariable ?: 'o';
        $keyVariable = $keyVariable ?: 'k';

        return $formatter->renderClosure($formatter->renderLines([
            $formatter->renderAssignment('var '.$arrayVariable, '[]', true),
            $formatter->renderStatement(
                'for',
                $formatter->renderCall(
                    $formatter->renderProperty($arrayVariable, 'push'),
                    [$objectVariable.'['.$keyVariable.']'],
                    true
                ),
                'var '.$keyVariable.' in '.$objectVariable,
                null,
                false
            ),
            $formatter->renderCode('return '.$arrayVariable, true, false),
        ], true, false), [$objectVariable]);
    }
165104
public static function getAllValuesOfKey(array $array, $key)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return null;
        }

        $values = [];

        foreach ($array as $index => $value) {
            if ($index === $key) {
                $values[] = $value;

                continue;
            }

            if (is_array($value)) {
                $recursiveValues = self::getAllValuesOfKey($value, $key);

                if (!empty($recursiveValues)) {
                    $merged = array_merge($values, $recursiveValues);
                    $values = $merged;
                }
            }
        }

        return $values;
    }
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;
    }
1214586
public static function getValue($array, $key, $default = null)
    {
        if (is_string($key)) {
            // Iterate path
            $keys = explode('.', $key);
            foreach ($keys as $key) {
                if (!isset($array[$key])) {
                    return $default;
                }
                $array = &$array[$key];
            }
            // Get value
            return $array;
        } elseif (is_null($key)) {
            // Get all data
            return $array;
        }
        return null;
    }