Garden\Validation::arraySelect PHP Method

arraySelect() private static method

Select the first non-empty value from an array.
private static arraySelect ( array $keys, array $array, mixed $default = null ) : mixed
$keys array An array of keys to try.
$array array The array to select from.
$default mixed The default value if non of the keys exist.
return mixed Returns the first non-empty value of {@link $default} if none are found.
    private static function arraySelect(array $keys, array $array, $default = null)
    {
        foreach ($keys as $key) {
            if (isset($array[$key]) && $array[$key]) {
                return $array[$key];
            }
        }
        return $default;
    }