code/libraries/joomlatools/library/model/state/state.php
public function offsetSet($name, $value)
    {
        if($this->offsetExists($name))
        {
            //Only filter if we have a value
            if($value !== null)
            {
                if($value !== '')
                {
                    //Only accepts scalar values and array
                    if(!is_scalar($value) && !is_array($value))
                    {
                        throw new UnexpectedValueException(
                            'Value needs to be an array or a scalar, "'.gettype($value).'" given'
                        );
                    }

                    $filter = $this->_data[$name]->filter;

                    if(!($filter instanceof KFilterInterface)) {
                        $filter =  $this->getObject('filter.factory')->createChain($filter);
                    }

                    $value = $filter->sanitize($value);
                }
                else $value = null;
            }

            $this->_data[$name]->value = $value;
        }
    }
public function offsetSet($name, $value)
    {
        if($this->offsetExists($name))
        {
            //Only filter if we have a value
            if($value !== null)
            {
                if($value !== '')
                {
                    //Only accepts scalar values and array
                    if(!is_scalar($value) && !is_array($value))
                    {
                        throw new UnexpectedValueException(
                            'Value needs to be an array or a scalar, "'.gettype($value).'" given'
                        );
                    }

                    $filter = $this->_data[$name]->filter;

                    if(!($filter instanceof KFilterInterface)) {
                        $filter =  $this->getObject('filter.factory')->createChain($filter);
                    }

                    $value = $filter->sanitize($value);
                }
                else $value = null;
            }

            $this->_data[$name]->value = $value;
        }
    }
public function offsetSet ( $ name , $ value ) { if ( $ this -> offsetExists ( $ name ) ) { //Only filter if we have a value if ( $ value !== null ) { if ( $ value !== '' ) { //Only accepts scalar values and array if ( ! is_scalar ( $ value ) && ! is_array ( $ value ) ) { throw new UnexpectedValueException ( 'Value needs to be an array or a scalar, "' . gettype ( $ value ) . '" given' ) ; } $ filter = $ this -> _data [ $ name ] -> filter ; if ( ! ( $ filter instanceof KFilterInterface ) ) { $ filter = $ this -> getObject ( 'filter.factory' ) -> createChain ( $ filter ) ; } $ value = $ filter -> sanitize ( $ value ) ; } else $ value = null ; } $ this -> _data [ $ name ] -> value = $ value ; } }
Set an state value

This function only accepts scalar or array values. Values are only filtered if not NULL. If the value is an empty
string it will be filtered to NULL. Values will only be set if the state exists. Function will not create new
states. Use the insert() function instead.

@param   string        $name
@param   mixed|array  $value
@throws UnexpectedValueException If the value is not a scalar or an array
@return  void
Set an state value