Passed
Pull Request — master (#42)
by Dmitriy
13:55
created

RebuildHook   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 3
b 0
f 0
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A executeBeforeFirstTest() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Tests\Integration;
6
7
use PHPUnit\Runner\BeforeFirstTestHook;
8
use Yiisoft\Composer\Config\Builder;
9
use Yiisoft\Composer\Config\Util\PathHelper;
10
11
final class RebuildHook implements BeforeFirstTestHook
12
{
13
    public function executeBeforeFirstTest(): void
14
    {
15
        if (!(bool) ($_SERVER['REBUILD'] ?? false)) {
16
            return;
17
        }
18
        $baseDir = PathHelper::realpath(__DIR__) . '/Environment';
19
20
        require_once $baseDir . '/vendor/autoload.php';
21
        echo 'Rebuild configs...' . PHP_EOL;
22
        Builder::rebuild($baseDir);
23
    }
24
}
25