public function __get($key) { foreach ($this->items as $item) { if ($item->meta_key == $key) { return $item->value; } } }