예제 #1
0
파일: Php.php 프로젝트: frenchfrogs/maker
 /**
  * Rendu d'un maker
  *
  * @param Maker $maker
  * @return string
  */
 public function maker(Maker $maker)
 {
     $content = '';
     // CONSTANT
     foreach ($maker->getConstants() as $name => $value) {
         $content .= sprintf('const %s = %s;', $name, $this->render('value', $value)) . PHP_EOL;
     }
     if (!empty($name)) {
         $content .= str_repeat(PHP_EOL, 2);
     }
     // PROPERTIES
     foreach ($maker->getProperties() as $property) {
         $content .= $this->render('property', $property) . str_repeat(PHP_EOL, 2);
     }
     // METHODS
     $methods = [];
     foreach ($maker->getMethods() as $method) {
         $methods[] = $this->render('method', $method);
     }
     $content .= implode(str_repeat(PHP_EOL, 2), $methods);
     // rendu globale
     $content = $this->render('maker_class', $maker, $content);
     return $content;
 }