public function convert(Expr\ArrayDimFetch $node, $returnAsArray = false)
 {
     $collected = $this->arrayManipulator->arrayNeedToBeSplit($node);
     if ($collected !== false) {
         return $this->splitArray($collected, $returnAsArray);
     }
     $result = $this->dispatcher->pVarOrNewExpr($node->var) . '[' . (null !== $node->dim ? $this->dispatcher->p($node->dim) : '') . ']';
     if ($returnAsArray === true) {
         return array('head' => '', 'lastExpr' => $result, 'vars' => array());
     }
     return $result;
 }
예제 #2
0
 public function convert(Expr\ArrayDimFetch $node, $returnAsArray = false)
 {
     $collected = $this->arrayManipulator->arrayNeedToBeSplit($node);
     if ($node->var instanceof Expr\StaticPropertyFetch) {
         if ($node->var->class->parts[0] === 'self') {
             $node->var = new Expr\PropertyFetch(new Expr\Variable('this'), $node->var->name);
             $this->logger->logNode("Change StaticProperty into PropertyFetch due to #188", $node);
         } else {
             $this->logger->logNode("StaticProperty on array not supported, see #188", $node);
         }
     }
     if ($collected !== false) {
         return $this->splitArray($collected, $returnAsArray);
     } else {
         $result = $this->dispatcher->pVarOrNewExpr($node->var) . '[' . (null !== $node->dim ? $this->dispatcher->p($node->dim) : '') . ']';
         if ($returnAsArray === true) {
             return array('head' => '', 'lastExpr' => $result);
         } else {
             return $result;
         }
     }
 }
 /**
  * @param Expr\MethodCall $node
  *
  * @return string
  */
 public function convert(Expr\MethodCall $node)
 {
     $collected = $this->assignManipulator->collectAssignInCondition($node->args);
     $node->args = $this->assignManipulator->transformAssignInConditionTest($node->args);
     return $collected->getCollected() . $this->dispatcher->pVarOrNewExpr($node->var) . '->' . $this->dispatcher->pObjectProperty($node->name) . '(' . $this->dispatcher->pCommaSeparated($node->args) . ')';
 }
예제 #4
0
 /**
  * @param Expr\MethodCall $node
  *
  * @return string
  */
 public function convert(Expr\MethodCall $node)
 {
     $collected = $this->assignManipulator->collectAssignInCondition($node->args);
     $node->args = $this->assignManipulator->transformAssignInConditionTest($node->args);
     return (!empty($collected['extracted']) ? implode("\n", $collected['extracted']) . "\n" : '') . $this->dispatcher->pVarOrNewExpr($node->var) . '->' . $this->dispatcher->pObjectProperty($node->name) . '(' . $this->dispatcher->pCommaSeparated($node->args) . ')';
 }