Пример #1
0
 public function convert(Stmt\Class_ $node)
 {
     $this->classManipulator->registerClassImplements($node);
     $node->name = $this->reservedWordReplacer->replace($node->name);
     $addArrayPlusMethod = false;
     foreach ($this->nodeFetcher->foreachNodes($node->stmts) as $stmt) {
         if ($stmt['node'] instanceof AssignOp\Plus && $stmt['node']->expr instanceof Array_) {
             $addArrayPlusMethod = true;
             break;
         }
     }
     return $this->dispatcher->pModifiers($node->type) . 'class ' . $node->name . (null !== $node->extends ? ' extends ' . $this->dispatcher->p($node->extends) : '') . (!empty($node->implements) ? ' implements ' . $this->dispatcher->pCommaSeparated($node->implements) : '') . "\n" . '{' . $this->dispatcher->pStmts($node->stmts) . "\n" . ($addArrayPlusMethod === true ? $this->printArrayPlusMethod() : '') . '}';
 }
 public function convert(Stmt\Interface_ $node)
 {
     $node->name = $this->reservedWordReplacer->replace($node->name);
     $extendsStmt = '';
     if (!empty($node->extends)) {
         $extendsStmt = ' extends ';
         $extends = array();
         foreach ($node->extends as $extend) {
             $extends[] = $this->classManipulator->findRightClass($extend, $this->dispatcher->getMetadata());
         }
         $extendsStmt .= implode(', ', $extends);
     }
     return 'interface ' . $node->name . $extendsStmt . "\n" . '{' . $this->dispatcher->pStmts($node->stmts) . "\n" . '}';
 }
Пример #3
0
 /**
  * @param Name $node
  *
  * @return Ambigous <string, unknown>
  */
 public function convert(Name $node)
 {
     return $this->classManipulator->findRightClass($node, $this->dispatcher->getMetadata());
 }
Пример #4
0
 public function convert(Stmt\Class_ $node)
 {
     $this->classManipulator->registerClassImplements($node);
     $node->name = $this->reservedWordReplacer->replace($node->name);
     return $this->dispatcher->pModifiers($node->type) . 'class ' . $node->name . (null !== $node->extends ? ' extends ' . $this->dispatcher->p($node->extends) : '') . (!empty($node->implements) ? ' implements ' . $this->dispatcher->pCommaSeparated($node->implements) : '') . "\n" . '{' . $this->dispatcher->pStmts($node->stmts) . "\n" . '}';
 }