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

AppModule   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 31
ccs 14
cts 14
cp 1
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fromClass() 0 9 1
A facadeClass() 0 3 1
A moduleName() 0 3 1
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