protected function execute(InputInterface $input, OutputInterface $output) { $filename = $input->getArgument('filename'); $printer = new PrettyPrinter(); $statements = $this->parser->parseStream($filename); $printer->printStatements($statements, $output); }
/** * @param string $filename * @param \Helmich\TypoScriptLint\Linter\Report\Report $report * @param \Helmich\TypoScriptLint\Linter\LinterConfiguration $configuration * @param \Symfony\Component\Console\Output\OutputInterface $output */ public function lintFile($filename, Report $report, LinterConfiguration $configuration, OutputInterface $output) { $file = new File($filename); try { $tokens = $this->tokenizer->tokenizeStream($filename); $statements = $this->parser->parseTokens($tokens); $this->lintTokenStream($tokens, $file, $configuration, $output); $this->lintSyntaxTree($statements, $file, $configuration, $output); } catch (TokenizerException $tokenizerException) { $file->addWarning(Warning::createFromTokenizerError($tokenizerException)); } catch (ParseError $parseError) { $file->addWarning(Warning::createFromParseError($parseError)); } if (count($file->getWarnings()) > 0) { $report->addFile($file); } }