History   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addHistoryEntry() 0 6 1
A getHistoryEntries() 0 4 1
A __toString() 0 11 2
1
<?php
2
3
namespace Saxulum\HttpClient;
4
5
class History
6
{
7
    /**
8
     * @var HistoryEntry[]
9
     */
10
    protected $historyEntries = array();
11
12
    /**
13
     * @param  HistoryEntry $historyEntry
14
     * @return $this
15
     */
16
    public function addHistoryEntry(HistoryEntry $historyEntry)
17
    {
18
        $this->historyEntries[] = $historyEntry;
19
20
        return $this;
21
    }
22
23
    /**
24
     * @return HistoryEntry[]
25
     */
26
    public function getHistoryEntries()
27
    {
28
        return $this->historyEntries;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function __toString()
35
    {
36
        $string = '';
37
        foreach ($this->historyEntries as $historyEntry) {
38
            $string .= (string) $historyEntry . HistoryEntry::SEPERATOR;
39
        }
40
41
        $string = substr($string, 0, strlen(HistoryEntry::SEPERATOR) * -1);
42
43
        return $string;
44
    }
45
}
46