Item   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 10 1
A setMessage() 0 4 1
A addReference() 0 4 1
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Support\Changelog;
9
10
class Item
11
{
12
    /** @var string */
13
    private $message;
14
15
    /**
16
     * @var int[]
17
     */
18
    private $references = [];
19
20 1
    public function __toString()
21
    {
22 1
        sort($this->references, SORT_NUMERIC);
23
24 1
        $references = implode('', array_map(function ($ref) {
25 1
            return " [#$ref]";
26 1
        }, $this->references));
27
28 1
        return "{$this->message}$references";
29
    }
30
31 2
    public function setMessage(string $message)
32
    {
33 2
        $this->message = $message;
34 2
    }
35
36 2
    public function addReference(int $reference)
37
    {
38 2
        $this->references[] = $reference;
39 2
    }
40
}
41