File   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Test Coverage

Coverage 73.32%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 63
ccs 11
cts 15
cp 0.7332
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getPath() 0 3 1
A getFileName() 0 3 1
A getNamespace() 0 3 1
A getModule() 0 3 1
A __construct() 0 5 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 09.03.19
6
 * Time: 21:51.
7
 */
8
9
namespace Foundation\Core;
10
11
final class File
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $name;
17
18
    /**
19
     * @var string
20
     */
21
    protected $path;
22
23
    /**
24
     * @var resource
25
     */
26
    protected $resource;
27
28
    /**
29
     * LarapiModule constructor.
30
     * @param $name
31
     */
32 43
    public function __construct(string $name, string $path, Resource $resource)
33
    {
34 43
        $this->name = $name;
35 43
        $this->path = $path;
36 43
        $this->resource = $resource;
0 ignored issues
show
Documentation Bug introduced by
It seems like $resource of type Foundation\Core\Resource is incompatible with the declared type resource of property $resource.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
37 43
    }
38
39
    /**
40
     * @return string
41
     */
42 43
    public function getName(): string
43
    {
44 43
        return $this->name;
45
    }
46
47
    /**
48
     * @return string
49
     */
50 43
    public function getPath(): string
51
    {
52 43
        return $this->path;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getNamespace(): string
59
    {
60
        return $this->resource->getNamespace().'\\'.$this->getName();
61
    }
62
63 43
    public function getFileName(): string
64
    {
65 43
        return $this->getName().'.php';
66
    }
67
68
    /**
69
     * @return Module
70
     */
71
    public function getModule(): Module
72
    {
73
        return $this->resource->getModule();
74
    }
75
}
76