Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DiffCommand | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| configure | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Copyright (C) 2018 Kunal Mehta <legoktm@debian.org> |
| 4 | * @license GPL-3.0-or-later |
| 5 | */ |
| 6 | |
| 7 | namespace Wikimedia\CloverDiff; |
| 8 | |
| 9 | use Symfony\Component\Console\Command\Command; |
| 10 | use Symfony\Component\Console\Input\InputArgument; |
| 11 | use Symfony\Component\Console\Input\InputInterface; |
| 12 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | |
| 14 | class DiffCommand extends Command { |
| 15 | /** |
| 16 | * Set up our parameters/arguments |
| 17 | */ |
| 18 | protected function configure(): void { |
| 19 | $this->setName( 'diff' ) |
| 20 | ->addArgument( |
| 21 | 'first', InputArgument::REQUIRED, |
| 22 | 'First clover.xml file' |
| 23 | )->addArgument( |
| 24 | 'second', InputArgument::REQUIRED, |
| 25 | 'Second clover.xml file' |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @param InputInterface $input stdin |
| 31 | * @param OutputInterface $output stdout |
| 32 | * |
| 33 | * @return int |
| 34 | */ |
| 35 | protected function execute( InputInterface $input, OutputInterface $output ): int { |
| 36 | $differ = new Differ(); |
| 37 | $diff = $differ->diff( |
| 38 | $input->getArgument( 'first' ), |
| 39 | $input->getArgument( 'second' ) |
| 40 | ); |
| 41 | |
| 42 | $printer = new DiffPrinter( $output ); |
| 43 | $lowered = $printer->show( $diff ); |
| 44 | |
| 45 | return $lowered ? 1 : 0; |
| 46 | } |
| 47 | } |