/** * Returns the part of the source code defining the property default value. * * @return string */ public function getDefaultValueDefinition() { return is_array($this->defaultValueDefinition) ? Resolver::getSourceCode($this->defaultValueDefinition) : $this->defaultValueDefinition; }
/** * Returns the part of the source code defining the parameter default value. * * @return string */ public function getDefaultValueDefinition() { return Resolver::getSourceCode($this->defaultValueDefinition); }
/** * Returns the default value. * * @return mixed * @throws \TokenReflection\Exception\RuntimeException If the property is not optional. * @throws \TokenReflection\Exception\RuntimeException If the property has no default value. */ public function getDefaultValue() { if (!$this->isOptional()) { throw new Exception\RuntimeException('Property is not optional.', Exception\RuntimeException::UNSUPPORTED, $this); } if (is_array($this->defaultValueDefinition)) { if (0 === count($this->defaultValueDefinition)) { throw new Exception\RuntimeException('Property has no default value.', Exception\RuntimeException::DOES_NOT_EXIST, $this); } $this->defaultValue = Resolver::getValueDefinition($this->defaultValueDefinition, $this); $this->defaultValueDefinition = Resolver::getSourceCode($this->defaultValueDefinition); } return $this->defaultValue; }