Argument   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 28
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fromString() 0 4 1
A isService() 0 4 1
A getServiceName() 0 8 2
1
<?php
2
3
namespace Sensorario\Container\Objects;
4
5
class Argument
6
{
7
    private $name;
8
9 13
    private function __construct(string $name)
10
    {
11 13
        $this->name = $name;
12 13
    }
13
14 13
    public static function fromString(string $name) : self
15
    {
16 13
        return new self($name);
17
    }
18
19 13
    public function isService() : bool
20
    {
21 13
        return 0 === strpos($this->name, '@');
22
    }
23
24 10
    public function getServiceName() : string
25
    {
26 10
        if ($this->isService()) {
27 5
            return str_replace('@', '', $this->name);
28
        }
29
30 9
        return $this->name;
31
    }
32
}
33