public function testCached() { $meta = new Meta(); $meta->set('a', 1); $meta->ofProperty('b')->set('c', 2); $this->cache->set('abc', $meta); $this->assertTrue($this->cache->has('abc')); $this->assertEquals($meta, $this->cache->get('abc')); $this->assertNotSame($meta, $this->cache->get('abc')); }
/** * Get metadata * * @return \Jasny\Meta */ public static function meta() { $class = get_called_class(); if (!isset(self::$meta__[$class])) { self::$meta__[$class] = \Jasny\Meta::fromAnnotations(new \ReflectionClass($class)); } return self::$meta__[$class]; }
/** * Add metadata for properties of a class * * @param Meta $meta * @param ReflectionClass $refl */ protected function addPropertyAnnotations(Meta $meta, ReflectionClass $refl) { $props = $refl->getProperties(); foreach ($props as $prop) { $propertyMeta = $this->create($prop); $meta->ofProperty($prop->getName())->set($propertyMeta); } }