Passed
Push — bugfix/support-windows ( 0e99e7...b5ecf8 )
by Jesús
06:33 queued 02:55
created

AppModule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Console\Domain\AllAppModules;
6
7
final class AppModule
8
{
9 6
    private function __construct(
10
        private string $moduleName,
11
        private string $facadeClass,
12
    ) {
13 6
    }
14
15 6
    public static function fromClass(string $facadeClass): self
16
    {
17 6
        $parts = explode('\\', $facadeClass);
18 6
        array_pop($parts);
19 6
        $moduleName = (string)end($parts);
20
21 6
        return new self(
22 6
            $moduleName,
23 6
            $facadeClass,
24 6
        );
25
    }
26
27 4
    public function moduleName(): string
28
    {
29 4
        return $this->moduleName;
30
    }
31
32
    /**
33
     * @return class-string
34
     */
35 6
    public function facadeClass(): string
36
    {
37 6
        return $this->facadeClass;
38
    }
39
}
40