Completed
Push — master ( 2cdd56...cec501 )
by Brian
08:59
created

Peer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
3
/*
4
 * Copyright 2017 Brian Smith <[email protected]>.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *      http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace phparia\Resources;
20
21
use phparia\Client\AriClient;
22
use phparia\Events\Event;
23
24
/**
25
 * Detailed information about a remote peer that communicates with Asterisk.
26
 *
27
 * @author Eric Smith <[email protected]>
28
 */
29
class Peer extends Resource
30
{
31
    /**
32
     * @var string (optional) - The IP address of the peer.
33
     */
34
    private $address;
35
36
    /**
37
     * @var string (optional) - An optional reason associated with the change in peer_status.
38
     */
39
    private $cause;
40
41
    /**
42
     * @var string The current state of the peer. Note that the values of the status are dependent on the underlying peer technology.
43
     */
44
    private $peerStatus;
45
46
    /**
47
     * @var string (optional) - The port of the peer.
48
     */
49
    private $port;
50
51
    /**
52
     * @var integer (optional) - The last known time the peer was contacted.
53
     */
54
    private $time;
55
56
    /**
57
     * @return string (optional) - The IP address of the peer.
58
     */
59
    public function getAddress()
60
    {
61
        return $this->address;
62
    }
63
64
    /**
65
     * @return string (optional) - An optional reason associated with the change in peer_status.
66
     */
67
    public function getCause()
68
    {
69
        return $this->cause;
70
    }
71
72
    /**
73
     * @return string The current state of the peer. Note that the values of the status are dependent on the underlying peer technology.
74
     */
75
    public function getPeerStatus()
76
    {
77
        return $this->peerStatus;
78
    }
79
80
    /**
81
     * @return string (optional) - The port of the peer.
82
     */
83
    public function getPort()
84
    {
85
        return $this->port;
86
    }
87
88
    /**
89
     * @return integer (optional) - The last known time the peer was contacted.
90
     */
91
    public function getTime()
92
    {
93
        return $this->time;
94
    }
95
96
    /**
97
     * @param AriClient $client
98
     * @param string $response
99
     */
100 View Code Duplication
    public function __construct(AriClient $client, $response)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
101
    {
102
        parent::__construct($client, $response);
103
104
        $this->address = $this->getResponseValue('address');
105
        $this->cause = $this->getResponseValue('cause');
106
        $this->peerStatus = $this->getResponseValue('peer_status');
107
        $this->port = $this->getResponseValue('port');
108
        $this->time = $this->getResponseValue('time');
109
    }
110
111
}
112