protected function compileInterfaces($var) { $stmts = array(); $class = $this->definition->getClass(); if (!class_exists($class, true)) { return array(); } $r = new \ReflectionClass($class); foreach ($r->getInterfaceNames() as $name) { if (!isset($this->definitions[$name])) { continue; } $definition = $this->definitions[$name]; if (!$definition instanceof Definition\InterfaceDefinition) { // Ignore aliased interfaces for interface injection continue; // throw new Exception\DomainException('Interface definition not instance of InterfaceDefinition'); } $setters = $definition->getSetters(); $stmts = array_merge($stmts, $this->compileSetters($setters, $var)); } return $stmts; }
/** * @param Definition $definition * @return $this */ public function addDefinition(Definition $definition) { $this->definitions[$definition->getKey()] = $definition; return $this; }