public function render($ret = false)
{
$static = null;
if ($this->visibility != 'const') {
$varDeclaration = ' $';
if ($this->static) {
$static = ' static';
}
} else {
$varDeclaration = ' ';
}
if (null === $this->docblock) {
$this->docblock = new DocblockGenerator(null, $this->indent);
}
$this->docblock->setTag('var', $this->type);
$this->output = PHP_EOL . $this->docblock->render(true);
$this->output .= $this->indent . $this->visibility . $static . $varDeclaration . $this->name;
if (null !== $this->value) {
if ($this->type == 'array') {
$val = count($this->value) == 0 ? 'array()' : $this->formatArrayValues();
$this->output .= ' = ' . $val . PHP_EOL;
} else {
if ($this->type == 'integer' || $this->type == 'int' || $this->type == 'float') {
$this->output .= ' = ' . $this->value . ';';
} else {
if ($this->type == 'boolean') {
$val = $this->value ? 'true' : 'false';
$this->output .= " = " . $val . ";";
} else {
$this->output .= " = '" . $this->value . "';";
}
}
}
} else {
$val = $this->type == 'array' ? 'array()' : 'null';
$this->output .= ' = ' . $val . ';';
}
if ($ret) {
return $this->output;
} else {
echo $this->output;
}
}