/** * @param string $namespace * The namespace in this element's scope * * @param string $name * The name of this structural element * * @param int $alternate_id * An alternate ID for the elemnet for use when * there are multiple definitions of the element */ protected function __construct(string $namespace, string $name, int $alternate_id = 0) { assert(!empty($name), "The name cannot be empty"); assert(!empty($namespace), "The namespace cannot be empty"); assert($namespace[0] === '\\', "The first character of a namespace must be \\, but got {$namespace}"); parent::__construct($name); $this->namespace = $namespace; $this->alternate_id = $alternate_id; }
/** * @param string $namespace * The namespace in this element's scope * * @param string $name * The name of this structural element * * @param int $alternate_id * An alternate ID for the elemnet for use when * there are multiple definitions of the element */ protected function __construct(string $namespace, string $name, int $alternate_id = 0) { // Transfer any relative namespace stuff from the // name to the namespace. $name_parts = explode('\\', $name); $name = array_pop($name_parts); $namespace = implode('\\', array_merge([$namespace], $name_parts)); parent::__construct($name); assert(!empty($name), "The name cannot be empty"); assert(!empty($namespace), "The namespace cannot be empty"); assert($namespace[0] === '\\', "The first character of a namespace must be \\, but got {$namespace}"); $this->namespace = $namespace; $this->alternate_id = $alternate_id; }
/** * @param FullyQualifiedClassName $fully_qualified_class_name * The fully qualified class name of the class in whic * this element exists * * @param string $name * A name if one is in scope or the empty string otherwise. * * @param int $alternate_id * An alternate ID for the element for use when * there are multiple definitions of the element */ protected function __construct(FullyQualifiedClassName $fully_qualified_class_name, string $name, int $alternate_id = 0) { parent::__construct($name); $this->fully_qualified_class_name = $fully_qualified_class_name; $this->alternate_id = $alternate_id; }