コード例 #1
0
 /**
  * @param \PHP\Manipulator\TokenContainer $container
  * @param mixed $params
  */
 public function run(TokenContainer $container)
 {
     $iterator = $container->getIterator();
     $operatorTokens = array();
     while ($iterator->valid()) {
         $token = $iterator->current();
         if ($this->evaluateConstraint('IsOperator', $token)) {
             $operatorTokens[] = $token;
         }
         $iterator->next();
     }
     $setWhitespaceAfterToken = new SetWhitespaceAfterToken();
     $setWhitespaceAfterToken->run($container, $operatorTokens, $this->getOption('afterOperator'));
     $setWhitespaceBeforeToken = new SetWhitespaceBeforeToken();
     $setWhitespaceBeforeToken->run($container, $operatorTokens, $this->getOption('beforeOperator'));
 }
コード例 #2
0
 /**
  * @dataProvider manipulateProvider
  * @covers \PHP\Manipulator\Helper\SetWhitespaceBeforeToken
  */
 public function testManipulate($container, $expectedContainer, $tokens, $whitespace, $strict)
 {
     $manipulator = new SetWhitespaceBeforeToken();
     $manipulator->run($container, $tokens, $whitespace);
     $this->assertTokenContainerMatch($expectedContainer, $container, $strict);
 }