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

AppModule::facadeClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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