/**
  * Returns static variables.
  *
  * @return array
  */
 public function getStaticVariables()
 {
     if (empty($this->staticVariables) && !empty($this->staticVariablesDefinition)) {
         foreach ($this->staticVariablesDefinition as $variableName => $variableDefinition) {
             $this->staticVariables[$variableName] = Resolver::getValueDefinition($variableDefinition, $this);
         }
     }
     return $this->staticVariables;
 }
Exemplo n.º 2
0
 /**
  * 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 (null === $this->defaultValue) {
         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);
     }
     return $this->defaultValue;
 }
Exemplo n.º 3
0
 /**
  * Returns the property default value.
  *
  * @return mixed
  */
 public function getDefaultValue()
 {
     if (is_array($this->defaultValueDefinition)) {
         $this->defaultValue = Resolver::getValueDefinition($this->defaultValueDefinition, $this);
         $this->defaultValueDefinition = Resolver::getSourceCode($this->defaultValueDefinition);
     }
     return $this->defaultValue;
 }