Zephir\ClassProperty::getValue PHP Méthode

getValue() public méthode

public getValue ( ) : mixed
Résultat mixed
    public function getValue()
    {
        if ($this->defaultValue['type'] == 'array') {
            $result = array();
            foreach ($this->original['default']['left'] as $key) {
                $result[] = $key['value']['value'];
            }
            $this->defaultValue['value'] = $result;
        }
        return $this->defaultValue['value'];
    }

Usage Example

Exemple #1
0
 /**
  * @param ClassProperty $property
  *
  * @return string
  */
 protected function buildProperty(ClassProperty $property)
 {
     $visibility = $property->isPublic() ? 'public' : $property->isProtected() ? 'protected' : 'private';
     if ($property->isStatic()) {
         $visibility = 'static ' . $visibility;
     }
     $source = $visibility . ' $' . $property->getName();
     switch ($property->getType()) {
         case 'null':
             // @TODO: Fix getting value
         // @TODO: Fix getting value
         case 'static-constant-access':
             break;
         case 'string':
             $source .= ' = "' . $property->getValue() . '"';
             break;
         case 'empty-array':
             $source .= ' = array()';
             break;
         case 'array':
             $source .= ' = array(' . implode(', ', $property->getValue()) . ')';
             break;
         default:
             $source .= ' = ' . $property->getValue();
             break;
     }
     $docBlock = new DocBlock($property->getDocBlock(), 4);
     return $docBlock . "\n    " . $source . ';';
 }