/** * Add a class constant * * @return null; */ public function addConstant(CodeBase $code_base, ClassConstant $constant) { $constant_fqsen = FullyQualifiedClassConstantName::make($this->getFQSEN(), $constant->getName()); // Update the FQSEN if its not associated with this // class yet if ($constant->getFQSEN() !== $constant_fqsen) { $constant = clone $constant; $constant->setFQSEN($constant_fqsen); } $code_base->addClassConstant($constant); }
/** * @return void */ public function addClassConstant(ClassConstant $constant) { $this->class_constant_map[$constant->getFQSEN()->getNameWithAlternateId()] = $constant; }
/** * @return array * Get a map from column name to row values for * this instance */ public function toRow() : array { $row = ['scope_name' => $this->primaryKeyValue(), 'fqsen' => (string) $this->constant->getFQSEN(), 'name' => (string) $this->constant->getName(), 'type' => (string) $this->constant->getUnionType(), 'flags' => $this->constant->getFlags(), 'context' => base64_encode(serialize($this->constant->getContext())), 'is_deprecated' => $this->constant->isDeprecated()]; return $row; }
/** * @param ClassConstant $constant * Any constant * * @param FullyQualifiedClassName $fqsen * The FQSEN to index the constant by * * @return null */ public function addConstantInScope(ClassConstant $constant, FullyQualifiedClassName $fqsen) { $name = $constant->getFQSEN()->getNameWithAlternateId(); $this->constant_map[(string) $fqsen][$name] = $constant; }