Passed
Pull Request — master (#15)
by Dmitriy
13:06
created

PluginTestCase::getFromConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Tests\Integration\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Composer\Config\Builder;
9
10
abstract class PluginTestCase extends TestCase
11
{
12
    private const BASE_DIRECTORY = __DIR__ . '/../Environment';
13
14
    private static array $configs = [];
15
16
    protected function registerConfig(string $name): void
17
    {
18
        if ((self::$configs[$name] ?? []) !== []) {
19
            return;
20
        }
21
        self::$configs[$name] = require Builder::path($name, self::BASE_DIRECTORY);
22
    }
23
24
    protected function getFromConfig(string $config, string $name)
25
    {
26
        return self::$configs[$config][$name];
27
    }
28
}
29