lithium\data\Model::_getMetaKey()
Helper method used by meta()
to generate and cache metadata values.
Parameters
-
string
$key
The name of the meta value to return, or
null
, to return all values.
Returns
mixedReturns the value of the meta key specified by $key
, or an array of all meta
values if $key
is null
.
Source
protected function _getMetaKey($key = null) {
if (!$key) {
$all = array_keys($this->_initializers);
$call = [&$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()));
}
}