public static function prepareOptions($value, $defaults = [])
    {
        if (is_string($value)) {
            $value = json_decode($value, true);
        }

        return is_array($value) ? array_merge($defaults, $value) : $defaults;
    }
public static function prepareOptions($value, $defaults = [])
    {
        if (is_string($value)) {
            $value = json_decode($value, true);
        }

        return is_array($value) ? array_merge($defaults, $value) : $defaults;
    }
public static function prepareOptions ( $ value , $ defaults = [ ] ) { if ( is_string ( $ value ) ) { $ value = json_decode ( $ value , true ) ; } return is_array ( $ value ) ? array_merge ( $ defaults , $ value ) : $ defaults ; }
Prepares options.

@param string|array $value Option. If provided a string will be assumed to be json and it will attempt to json_decode it and merge it with defaults. Or provide the array yourself.
@param array $defaults Defaults for the options array
@return array Merged array from $defaults and $value
Prepares options .