1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright 2014 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
|
|
|
* Details of a Stasis application |
26
|
|
|
* |
27
|
|
|
* @author Brian Smith <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class Application extends Resource |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var array Id's for bridges subscribed to. |
33
|
|
|
*/ |
34
|
|
|
private $bridgeIds; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var array Id's for channels subscribed to. |
38
|
|
|
*/ |
39
|
|
|
private $channelIds; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var array Names of the devices subscribed to. |
43
|
|
|
*/ |
44
|
|
|
private $deviceNames; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var array {tech}/{resource} for endpoints subscribed to. |
48
|
|
|
*/ |
49
|
|
|
private $endpointIds; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string Name of this application |
53
|
|
|
*/ |
54
|
|
|
private $name; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return array Id's for bridges subscribed to. |
58
|
|
|
*/ |
59
|
|
|
public function getBridgeIds() |
60
|
|
|
{ |
61
|
|
|
return $this->bridgeIds; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return array Id's for channels subscribed to. |
66
|
|
|
*/ |
67
|
|
|
public function getChannelIds() |
68
|
|
|
{ |
69
|
|
|
return $this->channelIds; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return array Names of the devices subscribed to. |
74
|
|
|
*/ |
75
|
|
|
public function getDeviceNames() |
76
|
|
|
{ |
77
|
|
|
return $this->deviceNames; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return array {tech}/{resource} for endpoints subscribed to. |
82
|
|
|
*/ |
83
|
|
|
public function getEndpointIds() |
84
|
|
|
{ |
85
|
|
|
return $this->endpointIds; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return string string Name of this application |
90
|
|
|
*/ |
91
|
|
|
public function getName() |
92
|
|
|
{ |
93
|
|
|
return $this->name; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param callable $callback |
98
|
|
|
*/ |
99
|
|
|
public function onApplicationReplaced(callable $callback) |
100
|
|
|
{ |
101
|
|
|
$this->on(Event::APPLICATION_REPLACED.'_'.$this->getName(), $callback); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param callable $callback |
106
|
|
|
*/ |
107
|
|
|
public function onceApplicationReplaced(callable $callback) |
108
|
|
|
{ |
109
|
|
|
$this->once(Event::APPLICATION_REPLACED.'_'.$this->getName(), $callback); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param AriClient $client |
114
|
|
|
* @param string $response |
115
|
|
|
*/ |
116
|
|
View Code Duplication |
public function __construct(AriClient $client, $response) |
117
|
|
|
{ |
118
|
|
|
parent::__construct($client, $response); |
119
|
|
|
|
120
|
|
|
$this->bridgeIds = $this->getResponseValue('bridge_ids'); |
|
|
|
|
121
|
|
|
$this->channelIds = $this->getResponseValue('channel_ids'); |
|
|
|
|
122
|
|
|
$this->deviceNames = $this->getResponseValue('device_names'); |
|
|
|
|
123
|
|
|
$this->endpointIds = $this->getResponseValue('endpoint_ids'); |
|
|
|
|
124
|
|
|
$this->name = $this->getResponseValue('name'); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
} |
128
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..