1 : <?php
2 :
3 : /**
4 : * Abstraction of an instance resource from the Twilio API.
5 : *
6 : * @category Services
7 : * @package Services_Twilio
8 : * @author Neuman Vong <neuman@twilio.com>
9 : * @license http://creativecommons.org/licenses/MIT/ MIT
10 : * @link http://pear.php.net/package/Services_Twilio
11 : */
12 : abstract class Services_Twilio_InstanceResource
13 : extends Services_Twilio_Resource
14 : {
15 : /**
16 : * @param mixed $params An array of updates, or a property name
17 : * @param mixed $value A value with which to update the resource
18 : *
19 : * @return null
20 : */
21 : public function update($params, $value = null)
22 : {
23 6 : if (!is_array($params)) {
24 5 : $params = array($params => $value);
25 5 : }
26 6 : $this->proxy->updateData($params);
27 6 : }
28 :
29 : /**
30 : * Set this resource's proxy.
31 : *
32 : * @param Services_Twilio_DataProxy $proxy An instance of DataProxy
33 : *
34 : * @return null
35 : */
36 : public function setProxy($proxy)
37 : {
38 0 : $this->proxy = $proxy;
39 0 : }
40 :
41 : /**
42 : * Get the value of a property on this resource.
43 : *
44 : * @param string $key The property name
45 : *
46 : * @return mixed Could be anything.
47 : */
48 : public function __get($key)
49 : {
50 25 : if ($subresource = $this->getSubresources($key)) {
51 19 : return $subresource;
52 : }
53 19 : return $this->proxy->$key;
54 : }
55 : }
|