Get the first non-empty element of a list.

@param array $list    The list to scan.
@param mixed $default If no non-empty element is found, return this value.

@return mixed The first non-empty element in the list.
348215
public static function getFirstNonEmptyElement($list, $default = null)
    {
        foreach ($list as $item) {
            if (empty($item) === false) {
                return $item;
            }
        }
        return $default;
    }
699367
public function get($key, $default = null)
    {
        $array = $this->objects;

        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;
    }
847053
protected function & getFromArray(&$array, $keys, $default = null)
    {
        $key = array_shift($keys);
        if (!isset($array[$key])) {
            return $default;
        }

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

        return $this->getFromArray($array[$key], $keys, $default);
    }
547678
public function get($key, $default = null)
    {
        return array_key_exists($key, $this->collection) ? $this->collection[$key] : $default;
    }
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;
    }
72535
private static function findInArray(array $array, string $key, $default = null)
    {
        if (($pos = strrpos($key, '.')) !== false) {
            $array = self::findInArray($array, substr($key, 0, $pos), $default);
            $key = substr($key, $pos + 1);
        }

        return is_array($array) && array_key_exists($key, $array) ? $array[$key] : $default;
    }
1006869
private static <T> T firstOf(final List<T> list) {
        return list.isEmpty()? null: list.get(0);
    }
154728
public function get($property, $default = null)
    {

        //if its an array of properties;
        if (is_array($property)) {
            $values = array();

            foreach ($property as $key => $prop) {
                if (isset($this->$prop)) {
                    $values[$prop] = $this->$prop;
                }
            }
            return (!empty($values)) ? $values : $default;
        }

        if (isset($this->$property)) {
            return $this->$property;
        }
        return $default;
    }
973219
private function getIn(array $array, array $keys, $default = null)
    {
        if (!$keys) {
            return $array;
        }

        // This is a micro-optimization, it is fast for non-nested keys, but fails for null values
        if (\count($keys) === 1 && isset($array[$keys[0]])) {
            return $array[$keys[0]];
        }

        $current = $array;
        foreach ($keys as $key) {
            if (!\is_array($current) || !\array_key_exists($key, $current)) {
                return $default;
            }

            $current = $current[$key];
        }

        return $current;
    }
1002396
function get($key, $default = null)
    {
        $index = array_search($key, $this->keys);

        if ($index !== false) {
            return $this->values[$index];
        } else {
            return $default;
        }
    }
751654
public function findOne (array $array, $callback, $default = null) {
		$filtered = array_filter($array, $callback);
		return count($filtered) ? reset($filtered) : $default;
	}
296045
public function get($key, $default = null)
    {
        $value = parent::get($key, $default);
        if (is_array($value)) {
            $value = array_shift($value);
        }
        return $value;
    }
1060579
public function get($key, $default = null)
    {
        $array = $this->data;
        foreach (explode(self::SEPERATOR, $key) as $item) {
            if (is_array($array) && array_key_exists($item, $array)) {
                $array = $array[$item];
            } else {
                return $default;
            }
        }

        return $array;
    }
226753
public function find( $key, $default = null )
	{
		if ( $key instanceof Model )
		{
			$key = $key->getKey();
		}

		return Arr::first( $this->items, function ( $itemKey, $model ) use ( $key )
		{
			return $model->getKey() == $key;
		}, $default );
	}
296850
public function get(string $key, $default = null)
    {
        $value = Arr::get($this->items, $key);

        if (\is_null($value)) {
            return \value($default);
        }

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

        return $default;
    }
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;
    }