public function get($class)
{
$class = new \ReflectionClass($class);
$name = $class->getName();
if (!isset($this->metadata[$name])) {
if ($this->cache) {
$hash = filemtime($class->getFileName());
foreach ($class->getTraits() as $trait) {
$hash += filemtime($trait->getFileName());
}
$current = $class;
while ($parent = $current->getParentClass()) {
$hash += filemtime($parent->getFileName());
$current = $parent;
}
$id = sprintf('%s%s.%s', $this->prefix, $hash, $name);
if ($config = $this->cache->fetch($id)) {
$this->metadata[$name] = new Metadata($this, $name, $config);
} else {
$this->cache->save($id, $this->load($class)->getConfig());
}
} else {
$this->load($class);
}
$this->subscribe($this->metadata[$name]);
}
return $this->metadata[$name];
}