public function __construct($class, $name, Addendum $addendum = null) { parent::__construct($class, $name); $this->annotations = (new Builder($addendum))->build($this); $this->addendum = $addendum; ConflictChecker::check($this, $this->annotations); }
public function __construct($data = [], $target = false) { $reflection = new ReflectionClass($this); $class = $reflection->name; if (isset(self::$_creationStack[$class])) { throw new CircularReferenceException("Circular annotation reference on '{$class}'", E_USER_ERROR); } self::$_creationStack[$class] = true; foreach ($data as $key => $value) { if ($reflection->hasProperty($key)) { $this->{$key} = $value; } $this->_properties[$key] = $value; } foreach ($reflection->getProperties(ReflectionProperty::IS_PUBLIC) as $field) { $this->_publicProperties[] = $field->name; } try { ConflictChecker::register($this, $target); TargetChecker::check($this, $target); } catch (UnexpectedValueException $ex) { throw $ex; } finally { unset(self::$_creationStack[$class]); } }