recursive field options getter

@param mixed $options
@param array $default
@return Closure
500899
protected function getOptions($options = null, $default = [])
    {
        if (empty($options)) {
            return $default;
        }
        if ($options instanceof Collection) {
            return $options->toArray();
        }
        if ($options instanceof Closure) {
            return $this->getOptions(call_user_func($options));
        }
        if (is_array($options)) {
            return $options;
        }
        return $options->toArray();
    }
296045
public function get($key, $default = null)
    {
        $value = parent::get($key, $default);
        if (is_array($value)) {
            $value = array_shift($value);
        }
        return $value;
    }
462598
public function getSeriesOption( $series, $option, $default = null )
    {
        $seriesTitle = $this->getSeriesTitle( $series ); 

        return ( isset( $this->options['seriesStorage'][$seriesTitle] ) && isset( $this->options['seriesStorage'][$seriesTitle][$option] ) )
            ?  $this->options['seriesStorage'][$seriesTitle][$option]
            :  $default;
    }
1297671
public function getOption($nameOrAlias, $default = null) {
        try {
            $option = $this->getCommand()->findOption($nameOrAlias);
            $value = $option->getValue();

            if ($value === null) {
                $value = $default;
            }

            return $value;
        } catch (OptionNotFoundException $ex) {}

        return $default;
    }
788569
public function getOpt($key, $default = false)
	{
		return (isset($this->opts[$key])) ? $this->opts[$key] : $default;
	}
56078
public function getValue($args, $default = null)
    {
        if (isset($args[$this->name])) {
            return $args[$this->name];
        }

        if (isset($args[$this->shortName])) {
            return $args[$this->shortName];
        }

        return $default;
    }
1346578
protected function option($key, $default = null)
    {
        return array_key_exists($key, $this->options) ? $this->options[$key] : $default;
    }
1300626
public function get($field, $default = null)
	{
		// if it's an object property, return it, else return the default
		return isset($this->user->{$field}) ? $this->user->{$field} : $default;
	}
832233
public static function getOpt($key, $default = null)
    {
        if (array_key_exists($key, self::$current)) {
            return self::$current[$key];
        }
        if (array_key_exists($key, self::$opts)) {
            return self::$opts[$key];
        }
        return $default;
    }
22142
public function getOption($name, $default = null)
    {
        if (!isset($this->options[$name])) {
            if (is_callable($default)) {
                $default = call_user_func($default);
            } if ($default instanceof \Exception) {
                throw $default;
            }
            return $default;
        }
        return $this->options[$name];
    }
903830
public function get($index, $default = null)
	{
		if ($this->hasByIndex($index))
		{
			return $this->store[$index];
		}

		if ($default instanceof \Closure)
		{
			return $default($this);
		}

		return $default;
	}
1011210
function get_option( $option, $default = null ) {
            $this->_logger->entrance( 'option = ' . $option );

            if ( ! $this->is_loaded() ) {
                $this->load();
            }

            if ( is_array( $this->_options ) ) {
                $value = isset( $this->_options[ $option ] ) ?
                    $this->_options[ $option ] :
                    $default;
            } else if ( is_object( $this->_options ) ) {
                $value = isset( $this->_options->{$option} ) ?
                    $this->_options->{$option} :
                    $default;
            } else {
                $value = $default;
            }

            /**
             * If it's an object, return a clone of the object, otherwise,
             * external changes of the object will actually change the value
             * of the object in the options manager which may lead to an unexpected
             * behaviour and data integrity when a store() call is triggered.
             *
             * Example:
             *      $object1    = $options->get_option( 'object1' );
             *      $object1->x = 123;
             *
             *      $object2    = $options->get_option( 'object2' );
             *      $object2->y = 'dummy';
             *
             *      $options->set_option( 'object2', $object2, true );
             *
             * If we don't return a clone of option 'object1', setting 'object2'
             * will also store the updated value of 'object1' which is quite not
             * an expected behaviour.
             *
             * @author Vova Feldman
             */
            return is_object( $value ) ? clone $value : $value;
        }
686145
public function get($option, $default = false)
    {
        return isset($this->options[$option]) ? $this->options[$option] : $default;
    }
1097285
public function find($name, $default = null)
    {
        return ($options = $this->fetchAll()->lists('value', 'key')) && $options->has($name)
            ? $options->get($name)
            : $default;
    }
119677
protected function mergeDefaultOptions($options = [])
    {
        $defaults = $this->getDefaultOptions();

        foreach (array_keys($defaults) as $key) {
            if (!isset($options[$key])) {
                $options[$key] = [];
            }
            $options[$key] += $defaults[$key];
        }

        return $options;
    }
8359
public static function parseDefaultOptions($options = [], $defaults = [])
    {
        array_walk($defaults, function ($value, $key) use (&$options) {
            if (!isset($options[$key])) {
                $options[$key] = $value;
            }
        });

        return $options;
    }
823633
public static function getArray(
        array $options,
        string $key,
        $default = null
    ) {
        if (array_key_exists($key, $options)) {
            return (array)$options[$key];
        }

        return $default;
    }