Collection::extractValue PHP Method

extractValue() public static method

Makes sure to provide a valid value for each filter method no matter if an object or an array is given
public static extractValue ( mixed $item, string $field ) : mixed
$item mixed
$field string
return mixed
    public static function extractValue($item, $field)
    {
        if (is_array($item) && isset($item[$field])) {
            return $item[$field];
        } else {
            if (is_object($item)) {
                return $item->{$field}();
            } else {
                return false;
            }
        }
    }