Maintainable access to the options array

- Passing no arguments returns the entire options array - Passing a single name argument returns the value for the option - Passing both a name and value, sets the value to the name key, and returns the value - Passing an array will merge the options with the array passed, for object like extension

Paramètres

(mixed) name: The key name of the option:

(mixed) value: Value to set the option:

Fichier

advagg_css_compress/css-compressor-3.x/src/lib/Option.inc, line 42

Classe

CSSCompression_Option
CSS Compressor [VERSION] [DATE] Corey Hart @ <a href="http://www.codenothing.com">http://www.codenothing.com</a>

Code

public function option($name = NULL, $value = NULL) {
    if ($name === NULL) {
        return $this->options;
    }
    else {
        if (is_array($name)) {
            return $this->merge($name);
        }
        else {
            if ($value === NULL) {
                return isset($this->options[$name]) ? $this->options[$name] : NULL;
            }
            else {
                // Readability doesn't signify custom settings
                if ($name != 'readability') {
                    $this->Control->mode = $this->custom;
                }
                return $this->options[$name] = $value;
            }
        }
    }
}