lithium\data\collection\RecordSet::_set PHP Method

_set() protected method

protected _set ( $data = null, $offset = null, $options = [] )
    protected function _set($data = null, $offset = null, $options = array())
    {
        if ($model = $this->_model) {
            $options += array('defaults' => false);
            $data = !is_object($data) ? $model::create($data, $options) : $data;
            $key = $model::key($data);
        } else {
            $key = $offset;
        }
        if (is_array($key)) {
            $key = count($key) === 1 ? current($key) : null;
        }
        return $key !== null ? $this->_data[$key] = $data : ($this->_data[] = $data);
    }