V1.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Studio;
  9. use Twilio\Domain;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\Rest\Studio\V1\FlowList;
  12. use Twilio\Version;
  13. /**
  14. * @property \Twilio\Rest\Studio\V1\FlowList flows
  15. * @method \Twilio\Rest\Studio\V1\FlowContext flows(string $sid)
  16. */
  17. class V1 extends Version {
  18. protected $_flows = null;
  19. /**
  20. * Construct the V1 version of Studio
  21. *
  22. * @param \Twilio\Domain $domain Domain that contains the version
  23. * @return \Twilio\Rest\Studio\V1 V1 version of Studio
  24. */
  25. public function __construct(Domain $domain) {
  26. parent::__construct($domain);
  27. $this->version = 'v1';
  28. }
  29. /**
  30. * @return \Twilio\Rest\Studio\V1\FlowList
  31. */
  32. protected function getFlows() {
  33. if (!$this->_flows) {
  34. $this->_flows = new FlowList($this);
  35. }
  36. return $this->_flows;
  37. }
  38. /**
  39. * Magic getter to lazy load root resources
  40. *
  41. * @param string $name Resource to return
  42. * @return \Twilio\ListResource The requested resource
  43. * @throws \Twilio\Exceptions\TwilioException For unknown resource
  44. */
  45. public function __get($name) {
  46. $method = 'get' . ucfirst($name);
  47. if (method_exists($this, $method)) {
  48. return $this->$method();
  49. }
  50. throw new TwilioException('Unknown resource ' . $name);
  51. }
  52. /**
  53. * Magic caller to get resource contexts
  54. *
  55. * @param string $name Resource to return
  56. * @param array $arguments Context parameters
  57. * @return \Twilio\InstanceContext The requested resource context
  58. * @throws \Twilio\Exceptions\TwilioException For unknown resource
  59. */
  60. public function __call($name, $arguments) {
  61. $property = $this->$name;
  62. if (method_exists($property, 'getContext')) {
  63. return call_user_func_array(array($property, 'getContext'), $arguments);
  64. }
  65. throw new TwilioException('Resource does not have a context');
  66. }
  67. /**
  68. * Provide a friendly representation
  69. *
  70. * @return string Machine friendly representation
  71. */
  72. public function __toString() {
  73. return '[Twilio.Studio.V1]';
  74. }
  75. }