lithium\data\Model::_getMetaKey PHP Method

_getMetaKey() protected method

Helper method used by meta() to generate and cache metadata values.
protected _getMetaKey ( string $key = null ) : mixed
$key string The name of the meta value to return, or `null`, to return all values.
return mixed Returns the value of the meta key specified by `$key`, or an array of all meta values if `$key` is `null`.
    protected function _getMetaKey($key = null)
    {
        if (!$key) {
            $all = array_keys($this->_initializers);
            $call = array(&$this, '_getMetaKey');
            return $all ? array_combine($all, array_map($call, $all)) + $this->_meta : $this->_meta;
        }
        if (isset($this->_meta[$key])) {
            return $this->_meta[$key];
        }
        if (isset($this->_initializers[$key]) && ($initializer = $this->_initializers[$key])) {
            unset($this->_initializers[$key]);
            return $this->_meta[$key] = $initializer(get_called_class());
        }
    }