Detail   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 124
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 124
rs 10
c 0
b 0
f 0
wmc 8
lcom 1
cbo 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A httpMethod() 0 4 1
A ipAddress() 0 4 1
A pid() 0 4 1
A status() 0 4 1
A uriAuthority() 0 4 1
A uriPathWithQuery() 0 4 1
A reduceDataToArray() 0 11 1
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2017-03-26
5
 */
6
7
namespace Net\Bazzline\Component\ApacheServerStatusParser\DomainModel;
8
9
class Detail implements ReduceDataAbleToArrayInterface
10
{
11
    const REDUCED_DATA_TO_ARRAY_KEY_HTTP_METHOD         = 'http_method';
12
    const REDUCED_DATA_TO_ARRAY_KEY_IP_ADDRESS          = 'ip_address';
13
    const REDUCED_DATA_TO_ARRAY_KEY_PID                 = 'pid';
14
    const REDUCED_DATA_TO_ARRAY_KEY_STATUS              = 'status';
15
    const REDUCED_DATA_TO_ARRAY_KEY_URI_AUTHORITY       = 'uri_authority';
16
    const REDUCED_DATA_TO_ARRAY_KEY_URI_PATH_WITH_QUERY = 'uri_path_with_query';
17
18
    /** @var string */
19
    private $httpMethod;
20
21
    /** @var string */
22
    private $ipAddress;
23
24
    /** @var string */
25
    private $pid;
26
27
    /** @var string */
28
    private $status;
29
30
    /** @var string */
31
    private $uriAuthority;
32
33
    /** @var string */
34
    private $uriPathWithQuery;
35
36
    /**
37
     * Detail constructor.
38
     *
39
     * @param string $httpMethod
40
     * @param string $ipAddress
41
     * @param string $pid
42
     * @param string $status
43
     * @param string $uriAuthority
44
     * @param string $uriPathWithQuery
45
     */
46
    public function __construct(
47
        $httpMethod,
48
        $ipAddress,
49
        $pid,
50
        $status,
51
        $uriAuthority,
52
        $uriPathWithQuery
53
    ) {
54
        $this->httpMethod       = $httpMethod;
55
        $this->ipAddress        = $ipAddress;
56
        $this->pid              = $pid;
57
        $this->status           = $status;
58
        $this->uriAuthority     = $uriAuthority;
59
        $this->uriPathWithQuery = $uriPathWithQuery;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function httpMethod()
66
    {
67
        return $this->httpMethod;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function ipAddress()
74
    {
75
        return $this->ipAddress;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function pid()
82
    {
83
        return $this->pid;
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function status()
90
    {
91
        return $this->status;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function uriAuthority()
98
    {
99
        return $this->uriAuthority;
100
    }
101
102
    /**
103
     * @return string
104
     */
105
    public function uriPathWithQuery()
106
    {
107
        return $this->uriPathWithQuery;
108
    }
109
110
    /**
111
     * @return array
112
     *  [
113
     *      'http_method'           : string,
114
     *      'ip_address'            : string,
115
     *      'pid'                   : string,
116
     *      'status'                : string,
117
     *      'uri_authority'         : string,
118
     *      'uri_path_with_query'   : string
119
     *  ]
120
     */
121
    public function reduceDataToArray()
122
    {
123
        return [
124
            self::REDUCED_DATA_TO_ARRAY_KEY_HTTP_METHOD          => $this->httpMethod,
125
            self::REDUCED_DATA_TO_ARRAY_KEY_IP_ADDRESS           => $this->ipAddress,
126
            self::REDUCED_DATA_TO_ARRAY_KEY_PID                  => $this->pid,
127
            self::REDUCED_DATA_TO_ARRAY_KEY_STATUS               => $this->status,
128
            self::REDUCED_DATA_TO_ARRAY_KEY_URI_AUTHORITY        => $this->uriAuthority,
129
            self::REDUCED_DATA_TO_ARRAY_KEY_URI_PATH_WITH_QUERY  => $this->uriPathWithQuery
130
        ];
131
    }
132
}
133