Beispiel #1
0
 /**
  * @param \EBT\ExtensionBuilder\Domain\Model\File
  * @param bool $prependPHPTag
  * @return string
  */
 public function renderFileObject(\EBT\ExtensionBuilder\Domain\Model\File $fileObject, $prependPHPTag = FALSE)
 {
     $stmts = $this->nodeFactory->getFileStatements($fileObject);
     $resultingCode = $this->render($stmts);
     if ($prependPHPTag) {
         return '<?php' . LF . $resultingCode;
     } else {
         return $resultingCode;
     }
 }
 /**
  * @param \PhpParser\Node $node
  * @return \PhpParser\Node|void
  */
 public function leaveNode(\PhpParser\Node $node)
 {
     if (null !== $node->__get('class')) {
         $oldClassName = \EBT\ExtensionBuilder\Parser\Utility\NodeConverter::getValueFromNode($node->__get('class'));
         if (strpos($oldClassName, $this->oldClassPrefix) !== false) {
             $newClassName = str_replace($this->oldClassPrefix, $this->newClassPrefix, $oldClassName);
             $node->setClass(\EBT\ExtensionBuilder\Parser\NodeFactory::buildNodeFromName($newClassName));
             return $node;
         }
     }
 }