Esempio n. 1
0
 public function __construct(Renderable $condition, $ifblock = NULL, $else = NULL)
 {
     parent::__construct($condition, $ifblock);
     if ($else) {
         $this->else = Utils::evalCallback($else);
     }
 }
Esempio n. 2
0
 public function __construct(Renderable $condition, $block = NULL)
 {
     $this->condition = $condition;
     if ($block) {
         $this->if = Utils::evalCallback($block);
     } else {
         $this->if = new Block();
     }
 }
Esempio n. 3
0
 public function __construct($license, $year, $holder)
 {
     $license = strtolower($license);
     $content = '';
     switch ($license) {
         case 'gpl':
             $content = self::GPL;
             break;
         case 'mit':
             $content = self::MIT;
             break;
         case 'bsd-3':
             $content = self::BSD3;
             break;
     }
     $content = Utils::renderStringTemplate($content, array('year' => $year, 'holder' => $holder));
     parent::__construct(explode("\n", $content));
 }
Esempio n. 4
0
 public function render(array $args = array())
 {
     $tab = Indenter::indent($this->indentLevel);
     $body = '';
     $body .= $tab . "/**\n";
     foreach ($this->lines as $line) {
         if (is_string($line)) {
             $body .= $tab . ' * ' . $line . "\n";
         } else {
             if ($line instanceof Renderable) {
                 $subbody = rtrim($line->render());
                 // trim the trailing white-space
                 $sublines = explode("\n", $subbody);
                 foreach ($sublines as $subline) {
                     $body .= $tab . ' * ' . $subline . "\n";
                 }
             } else {
                 throw new Exception("Unsupported line object.");
             }
         }
     }
     $body .= " */\n";
     return Utils::renderStringTemplate($body, array_merge($this->args, $args));
 }
Esempio n. 5
0
 public function render(array $args = array())
 {
     $tab = Indenter::indent($this->indentLevel);
     $body = '';
     foreach ($this->lines as $line) {
         if (is_string($line)) {
             $body .= $tab . $line . "\n";
         } else {
             if ($line instanceof Renderable) {
                 $subbody = rtrim($line->render());
                 // trim the trailing white-space
                 $sublines = explode("\n", $subbody);
                 foreach ($sublines as $subline) {
                     $body .= $tab . $subline . "\n";
                 }
             } else {
                 var_dump($line);
                 throw new InvalidArgumentTypeException("Unsupported line object type", $line, array('string', 'Renderable'));
             }
         }
     }
     return Utils::renderStringTemplate($body, array_merge($this->args, $args));
 }
Esempio n. 6
0
 public function __construct($block)
 {
     $this->else = Utils::evalCallback($block);
 }