From 3122b8c88ae0e77a6ceeb3c71dab5f41881b614e Mon Sep 17 00:00:00 2001 From: Holger Woltersdorf Date: Tue, 19 Jul 2016 23:16:29 +0200 Subject: [PATCH 1/2] Removed obsolete root dir in stub, Application and TestReporterCommand --- composer/bin/test-reporter | 4 +-- src/Application.php | 37 +++++---------------- src/ConsoleCommands/TestReporterCommand.php | 24 ++----------- 3 files changed, 11 insertions(+), 54 deletions(-) diff --git a/composer/bin/test-reporter b/composer/bin/test-reporter index 3a1e766..71e55e8 100755 --- a/composer/bin/test-reporter +++ b/composer/bin/test-reporter @@ -28,7 +28,5 @@ if (!defined('PHP_TEST_REPORTER_COMPOSER_INSTALL')) { ); } -$rootDir = realpath(dirname(PHP_TEST_REPORTER_COMPOSER_INSTALL) . '/..'); - -$app = new Application($rootDir, 'Code Climate PHP Test Reporter', Version::VERSION); +$app = new Application('Code Climate PHP Test Reporter', Version::VERSION); $app->run(); diff --git a/src/Application.php b/src/Application.php index ccdc800..c3fdfc7 100644 --- a/src/Application.php +++ b/src/Application.php @@ -11,27 +11,7 @@ */ class Application extends BaseApplication { - /** - * Path to project root directory. - * @var string - */ - private $rootDir; - - /** - * Constructor. - * - * @param string $rootDir Path to project root directory. - * @param string $name The name of the application - * @param string $version The version of the application - */ - public function __construct($rootDir, $name = 'UNKNOWN', $version = 'UNKNOWN') - { - $this->rootDir = $rootDir; - - parent::__construct($name, $version); - } - - // internal method + // internal method /** * {@inheritdoc} @@ -56,14 +36,13 @@ protected function getDefaultCommands() return $defaultCommands; } - /** - * Create TestReporterCommand. - * @return TestReporterCommand - */ - protected function createTestReporterCommand() - { - $command = new TestReporterCommand(); - $command->setRootDir($this->rootDir); + /** + * Create TestReporterCommand. + * @return TestReporterCommand + */ + protected function createTestReporterCommand() + { + $command = new TestReporterCommand(); return $command; } diff --git a/src/ConsoleCommands/TestReporterCommand.php b/src/ConsoleCommands/TestReporterCommand.php index 0db923a..8d0c41d 100644 --- a/src/ConsoleCommands/TestReporterCommand.php +++ b/src/ConsoleCommands/TestReporterCommand.php @@ -14,19 +14,13 @@ */ class TestReporterCommand extends Command { - /** - * Path to project root directory. - * @var string - */ - protected $rootDir; - /** * {@inheritdoc} * @see \Symfony\Component\Console\Command\Command::configure() */ protected function configure() { - $this + $this ->setName('test-reporter') ->setDescription('Code Climate PHP Test Reporter') ->addOption( @@ -78,19 +72,5 @@ protected function execute(InputInterface $input, OutputInterface $output) } return $ret; - } - - // accessor - - /** - * Set root directory. - * - * @param string $rootDir Path to project root directory. - * - * @return void - */ - public function setRootDir($rootDir) - { - $this->rootDir = $rootDir; - } + } } From 4888095b58c9204d67ca36f855ad87e06583ddd2 Mon Sep 17 00:00:00 2001 From: Holger Woltersdorf Date: Fri, 29 Jul 2016 23:48:19 +0200 Subject: [PATCH 2/2] Fixed indention by tabs --- src/Application.php | 16 ++++++++-------- src/ConsoleCommands/TestReporterCommand.php | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Application.php b/src/Application.php index c3fdfc7..5ce0e60 100644 --- a/src/Application.php +++ b/src/Application.php @@ -11,7 +11,7 @@ */ class Application extends BaseApplication { - // internal method + // internal method /** * {@inheritdoc} @@ -36,13 +36,13 @@ protected function getDefaultCommands() return $defaultCommands; } - /** - * Create TestReporterCommand. - * @return TestReporterCommand - */ - protected function createTestReporterCommand() - { - $command = new TestReporterCommand(); + /** + * Create TestReporterCommand. + * @return TestReporterCommand + */ + protected function createTestReporterCommand() + { + $command = new TestReporterCommand(); return $command; } diff --git a/src/ConsoleCommands/TestReporterCommand.php b/src/ConsoleCommands/TestReporterCommand.php index 8d0c41d..53719d4 100644 --- a/src/ConsoleCommands/TestReporterCommand.php +++ b/src/ConsoleCommands/TestReporterCommand.php @@ -20,7 +20,7 @@ class TestReporterCommand extends Command */ protected function configure() { - $this + $this ->setName('test-reporter') ->setDescription('Code Climate PHP Test Reporter') ->addOption( @@ -72,5 +72,5 @@ protected function execute(InputInterface $input, OutputInterface $output) } return $ret; - } + } }