setStatic() public method

Set the property static flag
public setStatic ( boolean $static = false ) : PropertyGenerator
$static boolean
return PropertyGenerator
Example #1
0
 /**
  * Get properties
  *
  * @return void
  */
 protected function getClassProperties()
 {
     // Detect and set properties
     $properties = $this->getDefaultProperties();
     if (count($properties) > 0) {
         foreach ($properties as $name => $value) {
             $property = $this->getProperty($name);
             $visibility = 'public';
             if ($property->isPublic()) {
                 $visibility = 'public';
             } else {
                 if ($property->isProtected()) {
                     $visibility = 'protected';
                 } else {
                     if ($property->isPrivate()) {
                         $visibility = 'private';
                     }
                 }
             }
             $doc = $property->getDocComment();
             if (null !== $doc && strpos($doc, '/*') !== false) {
                 $docblock = Generator\DocblockGenerator::parse($doc);
                 $desc = $docblock->getDesc();
                 $type = $docblock->getTag('var');
             } else {
                 $type = strtolower(gettype($value));
                 $desc = null;
             }
             if (is_array($value)) {
                 $formattedValue = count($value) == 0 ? null : $value;
             } else {
                 $formattedValue = $value;
             }
             $prop = new Generator\PropertyGenerator($property->getName(), $type, $formattedValue, $visibility);
             $prop->setStatic($property->isStatic());
             $prop->setDesc($desc);
             $this->generator->code()->addProperty($prop);
         }
     }
 }