Argument::fromString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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