Exemple #1
0
 /**
  * Generate a constant declaration and return it.
  *
  * @return string The generated constant declaration.
  */
 public function generate()
 {
     $lineFeed = self::getConfig()->getNewline();
     $code = $this->generateDocBlock();
     $code .= "const {$this->name} = {$this->value->generate()};" . $lineFeed;
     return $code;
 }
Exemple #2
0
 /**
  * Generate the parameter and return it.
  *
  * @return string The generated parameter.
  */
 public function generate()
 {
     $code = $this->type ? $this->type . ' ' : '';
     $code .= '$' . $this->name;
     $code .= $this->value ? ' = ' . $this->value->generate() : '';
     return $code;
 }
Exemple #3
0
 /**
  * Generate the property and return it.
  *
  * @return string The generated property.
  */
 public function generate()
 {
     $visibility = $this->getVisibilityKeyword();
     $lineFeed = self::getConfig()->getNewline();
     $code = $this->generateDocBlock();
     $code .= $visibility . ' ';
     $code .= $this->isStatic ? 'static ' : '';
     $code .= '$' . $this->name;
     $code .= $this->value ? " = " . $this->value->generate() : '';
     $code .= ';' . $lineFeed;
     return $code;
 }
Exemple #4
0
 /**
  * Test if throws an exception if the value cannot be auto discovered.
  *
  * @expectedException \UnexpectedValueException
  */
 public function testExceptionForTypeAutoDiscovering()
 {
     $value = new PHPValue(new \stdClass());
     $value->generate();
 }