Code Duplication    Length = 59-60 lines in 6 locations

src/wormling/phparia/Events/ChannelCallerId.php 1 location

@@ 29-87 (lines=59) @@
26
 *
27
 * @author Brian Smith <[email protected]>
28
 */
29
class ChannelCallerId extends Event implements IdentifiableEventInterface
30
{
31
    /**
32
     * @var int The integer representation of the Caller Presentation value.
33
     */
34
    private $callerPresentation;
35
36
    /**
37
     * @var string The text representation of the Caller Presentation value.
38
     */
39
    private $callerPresentationTxt;
40
41
    /**
42
     * @var Channel
43
     */
44
    private $channel;
45
46
    /**
47
     * @return int The integer representation of the Caller Presentation value.
48
     */
49
    public function getCallerPresentation()
50
    {
51
        return $this->callerPresentation;
52
    }
53
54
    /**
55
     * @return string The text representation of the Caller Presentation value.
56
     */
57
    public function getCallerPresentationTxt()
58
    {
59
        return $this->callerPresentationTxt;
60
    }
61
62
    /**
63
     * @return Channel
64
     */
65
    public function getChannel()
66
    {
67
        return $this->channel;
68
    }
69
70
    public function getEventId()
71
    {
72
        return "{$this->getType()}_{$this->getChannel()->getId()}";
73
    }
74
75
    /**
76
     * @param AriClient $client
77
     * @param string $response
78
     */
79
    public function __construct(AriClient $client, $response)
80
    {
81
        parent::__construct($client, $response);
82
83
        $this->callerPresentation = $this->getResponseValue('caller_presentation');
84
        $this->callerPresentationTxt = $this->getResponseValue('caller_presentation_txt');
85
        $this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client);
86
    }
87
}
88

src/wormling/phparia/Events/ChannelDialplan.php 1 location

@@ 29-87 (lines=59) @@
26
 *
27
 * @author Brian Smith <[email protected]>
28
 */
29
class ChannelDialplan extends Event implements IdentifiableEventInterface
30
{
31
    /**
32
     * @var Channel
33
     */
34
    private $channel;
35
36
    /**
37
     * @var string The application about to be executed.
38
     */
39
    private $dialplanApp;
40
41
    /**
42
     * @var string The data to be passed to the application.
43
     */
44
    private $dialplanAppData;
45
46
    /**
47
     * @return Channel
48
     */
49
    public function getChannel()
50
    {
51
        return $this->channel;
52
    }
53
54
    /**
55
     * @return string The application about to be executed.
56
     */
57
    public function getDialplanApp()
58
    {
59
        return $this->dialplanApp;
60
    }
61
62
    /**
63
     * @return string The data to be passed to the application.
64
     */
65
    public function getDialplanAppData()
66
    {
67
        return $this->dialplanAppData;
68
    }
69
70
    public function getEventId()
71
    {
72
        return "{$this->getType()}_{$this->getChannel()->getId()}";
73
    }
74
75
    /**
76
     * @param AriClient $client
77
     * @param string $response
78
     */
79
    public function __construct(AriClient $client, $response)
80
    {
81
        parent::__construct($client, $response);
82
83
        $this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client);
84
        $this->dialplanApp = $this->getResponseValue('dialplan_app');
85
        $this->dialplanAppData = $this->getResponseValue('dialplan_app_data');
86
    }
87
}
88

src/wormling/phparia/Events/ChannelDtmfReceived.php 1 location

@@ 30-89 (lines=60) @@
27
 *
28
 * @author Brian Smith <[email protected]>
29
 */
30
class ChannelDtmfReceived extends Event implements IdentifiableEventInterface
31
{
32
    /**
33
     * @var Channel The channel on which DTMF was received
34
     */
35
    private $channel;
36
37
    /**
38
     * @var string DTMF digit received (0-9, A-E, # or *)
39
     */
40
    private $digit;
41
42
    /**
43
     * @var int Number of milliseconds DTMF was received
44
     */
45
    private $durationMs;
46
47
    /**
48
     * @return Channel
49
     */
50
    public function getChannel()
51
    {
52
        return $this->channel;
53
    }
54
55
    /**
56
     * @return string DTMF digit received (0-9, A-E, # or *)
57
     */
58
    public function getDigit()
59
    {
60
        return $this->digit;
61
    }
62
63
    /**
64
     * @return int Number of milliseconds DTMF was received
65
     */
66
    public function getDurationMs()
67
    {
68
        return $this->durationMs;
69
    }
70
71
    public function getEventId()
72
    {
73
        return "{$this->getType()}_{$this->getChannel()->getId()}";
74
    }
75
76
    /**
77
     * @param AriClient $client
78
     * @param string $response
79
     */
80
    public function __construct(AriClient $client, $response)
81
    {
82
        parent::__construct($client, $response);
83
84
        $this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client);
85
        $this->digit = $this->getResponseValue('digit');
86
        $this->durationMs = $this->getResponseValue('duration_ms');
87
    }
88
89
}
90

src/wormling/phparia/Events/ChannelHangupRequest.php 1 location

@@ 30-88 (lines=59) @@
27
 * @author Brian Smith <[email protected]>
28
 * @todo Add cause constants
29
 */
30
class ChannelHangupRequest extends Event implements IdentifiableEventInterface
31
{
32
    /**
33
     * @var int (optional) - Integer representation of the cause of the hangup.
34
     */
35
    private $cause;
36
37
    /**
38
     * @var \phparia\Resources\Channel The channel on which the hangup was requested.
39
     */
40
    private $channel;
41
42
    /**
43
     * @var boolean (optional) - Whether the hangup request was a soft hangup request.
44
     */
45
    private $soft;
46
47
    /**
48
     * @return int
49
     */
50
    public function getCause()
51
    {
52
        return $this->cause;
53
    }
54
55
    /**
56
     * @return Channel
57
     */
58
    public function getChannel()
59
    {
60
        return $this->channel;
61
    }
62
63
    /**
64
     * @return boolean
65
     */
66
    public function getSoft()
67
    {
68
        return $this->soft;
69
    }
70
71
    public function getEventId()
72
    {
73
        return "{$this->getType()}_{$this->getChannel()->getId()}";
74
    }
75
76
    /**
77
     * @param AriClient $client
78
     * @param string $response
79
     */
80
    public function __construct(AriClient $client, $response)
81
    {
82
        parent::__construct($client, $response);
83
84
        $this->cause = $this->getResponseValue('cause');
85
        $this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client);
86
        $this->soft = $this->getResponseValue('soft');
87
    }
88
}
89

src/wormling/phparia/Events/ChannelVarset.php 1 location

@@ 29-87 (lines=59) @@
26
 *
27
 * @author Brian Smith <[email protected]>
28
 */
29
class ChannelVarset extends Event implements IdentifiableEventInterface
30
{
31
    /**
32
     * @var Channel (optional) - The channel on which the variable was set. If missing, the variable is a global variable.
33
     */
34
    private $channel;
35
36
    /**
37
     * @var string The new value of the variable.
38
     */
39
    private $value;
40
41
    /**
42
     * @var string The variable that changed.
43
     */
44
    private $variable;
45
46
    /**
47
     * @return Channel (optional) - The channel on which the variable was set. If missing, the variable is a global variable.
48
     */
49
    public function getChannel()
50
    {
51
        return $this->channel;
52
    }
53
54
    /**
55
     * @return string The new value of the variable.
56
     */
57
    public function getValue()
58
    {
59
        return $this->value;
60
    }
61
62
    /**
63
     * @return string The variable that changed.
64
     */
65
    public function getVariable()
66
    {
67
        return $this->variable;
68
    }
69
70
    public function getEventId()
71
    {
72
        return "{$this->getType()}_{$this->getChannel()->getId()}";
73
    }
74
75
    /**
76
     * @param AriClient $client
77
     * @param string $response
78
     */
79
    public function __construct(AriClient $client, $response)
80
    {
81
        parent::__construct($client, $response);
82
83
        $this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client);
84
        $this->value = $this->getResponseValue('value');
85
        $this->variable = $this->getResponseValue('variable');
86
    }
87
}
88

src/wormling/phparia/Events/StasisStart.php 1 location

@@ 29-87 (lines=59) @@
26
 *
27
 * @author Brian Smith <[email protected]>
28
 */
29
class StasisStart extends Event implements IdentifiableEventInterface
30
{
31
    /**
32
     * @var array Arguments to the application
33
     */
34
    private $args;
35
36
    /**
37
     * @var Channel
38
     */
39
    private $channel;
40
41
    /**
42
     * @var Channel (optional)
43
     */
44
    private $replaceChannel;
45
46
    /**
47
     * @return array Arguments to the application
48
     */
49
    public function getArgs()
50
    {
51
        return $this->args;
52
    }
53
54
    /**
55
     * @return Channel
56
     */
57
    public function getChannel()
58
    {
59
        return $this->channel;
60
    }
61
62
    /**
63
     * @return Channel (optional)
64
     */
65
    public function getReplaceChannel()
66
    {
67
        return $this->replaceChannel;
68
    }
69
70
    public function getEventId()
71
    {
72
        return "{$this->getType()}_{$this->getChannel()->getId()}";
73
    }
74
75
    /**
76
     * @param AriClient $client
77
     * @param string $response
78
     */
79
    public function __construct(AriClient $client, $response)
80
    {
81
        parent::__construct($client, $response);
82
83
        $this->args = $this->getResponseValue('args');
84
        $this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client);
85
        $this->replaceChannel = $this->getResponseValue('replace_channel', '\phparia\Resources\Channel', $client);
86
    }
87
}
88