예제 #1
0
 public function testWhitespace()
 {
     $config = new Config();
     $this->assertTrue($config->getWhitespace('before_curly'));
     $this->assertFalse($config->getWhitespace('after_open'));
     $this->assertTrue($config->getWhitespace('before_assignment', 'assignments'));
 }
 public function __construct(Parser $parser, Config $config)
 {
     $this->config = $config;
     $this->parser = $parser;
     $this->writer = new Writer(['indentation_character' => $config->getIndentation('character') == 'tab' ? "\t" : ' ', 'indentation_size' => $config->getIndentation('size')]);
     // define rules
     $this->defaultFormatter = new DefaultFormatter($parser, $config, $this->writer);
     $this->commentsFormatter = new CommentsFormatter($parser, $config, $this->writer, $this->defaultFormatter);
     $this->indentationFormatter = new IndentationFormatter($parser, $config, $this->writer, $this->defaultFormatter);
     $this->newlineFormatter = new NewlineFormatter($parser, $config, $this->writer, $this->defaultFormatter);
     $this->whitespaceFormatter = new WhitespaceFormatter($parser, $config, $this->writer, $this->defaultFormatter);
     $this->blanksFormatter = new BlanksFormatter($parser, $config, $this->writer, $this->defaultFormatter);
 }