/** * Meta API for this type * * @param string $key Meta key to retrieve or empty to retrieve all. * * @return ObjectMeta|\Silk\Meta\Meta */ public function meta($key = '') { $meta = new ObjectMeta(static::OBJECT_TYPE, $this->id); if ($key) { return $meta->get($key); } return $meta; }
/** * @test */ public function it_has_a_fluent_setter() { $meta = new ObjectMeta('post', 123); $meta->set('a', 'b')->set('foo', 'bar'); $this->assertSame(['a' => ['b'], 'foo' => ['bar']], get_metadata('post', 123)); }