Segment::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Fhp\Segment;
4
5
/**
6
 * Class Segment
7
 * @package Fhp\Segment
8
 */
9
class Segment extends AbstractSegment
10
{
11
    /**
12
     * @param string $string
13
     * @return Segment
14
     */
15
    public static function createFromString($string)
16
    {
17
        $lines = explode('+', $string);
18
        $header = array_shift($lines);
19
        $headerParts = explode(':', $header);
20
21
        $name = strtoupper($headerParts[0]);
22
        $segmentNumber = $headerParts[1];
23
        $version = $headerParts[2];
24
25
        return new self($name, 0, $segmentNumber, $version, $lines);
0 ignored issues
show
Unused Code introduced by
The call to Segment::__construct() has too many arguments starting with $lines.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getName()
32
    {
33
        return $this->type;
34
    }
35
}
36