| Conditions | 4 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 11 |
| Lines | 10 |
| Ratio | 41.67 % |
| Tests | 6 |
| CRAP Score | 5.5021 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 12 | public function __construct() |
|
| 24 | { |
||
| 25 | 12 | if (defined('PARAUNIT_PHAR_FILE')) { |
|
| 26 | // Paraunit is running as a standalone PHAR archive |
||
| 27 | // PHPUnit is embedded in the archive, self execute it in special mode |
||
| 28 | $this->phpUnitBin = PARAUNIT_PHAR_FILE . ' phpunit'; |
||
| 29 | |||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | 12 | View Code Duplication | if (file_exists(__DIR__ . self::PHPUNIT_RELPATH_FOR_VENDOR)) { |
|
|
|||
| 34 | $this->phpUnitBin = realpath(__DIR__ . self::PHPUNIT_RELPATH_FOR_VENDOR); |
||
| 35 | |||
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | 12 | View Code Duplication | if (file_exists(__DIR__ . self::PHPUNIT_RELPATH_FOR_STANDALONE)) { |
| 40 | 12 | $this->phpUnitBin = realpath(__DIR__ . self::PHPUNIT_RELPATH_FOR_STANDALONE); |
|
| 41 | |||
| 42 | 12 | return; |
|
| 43 | } |
||
| 44 | |||
| 45 | throw new \RuntimeException('PHPUnit bin not found'); |
||
| 46 | } |
||
| 47 | |||
| 56 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.