ImportApp   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
dl 0
loc 15
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Package\Module\Import;
6
7
use ReflectionClass;
8
9
use function assert;
10
use function dirname;
11
use function is_dir;
12
use function sprintf;
13
14
final class ImportApp
15
{
16
    public string $appDir;
17
18
    public function __construct(
19
        public string $host,
20
        public string $appName,
21
        public string $context,
22
    ) {
23
        /** @var class-string $appModuleClass */
24
        $appModuleClass = sprintf('%s\\Module\\AppModule', $this->appName);
25
        $appModuleClassName = (string) (new ReflectionClass($appModuleClass))->getFileName();
26
        $appDir = dirname($appModuleClassName, 3);
27
        assert(is_dir($appDir));
28
        $this->appDir = $appDir;
29
    }
30
}
31