Accounts.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest;
  9. use Twilio\Domain;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\Rest\Accounts\V1;
  12. /**
  13. * @property \Twilio\Rest\Accounts\V1 v1
  14. * @property \Twilio\Rest\Accounts\V1\CredentialList credentials
  15. */
  16. class Accounts extends Domain {
  17. protected $_v1 = null;
  18. /**
  19. * Construct the Accounts Domain
  20. *
  21. * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with
  22. * Twilio
  23. * @return \Twilio\Rest\Accounts Domain for Accounts
  24. */
  25. public function __construct(Client $client) {
  26. parent::__construct($client);
  27. $this->baseUrl = 'https://accounts.twilio.com';
  28. }
  29. /**
  30. * @return \Twilio\Rest\Accounts\V1 Version v1 of accounts
  31. */
  32. protected function getV1() {
  33. if (!$this->_v1) {
  34. $this->_v1 = new V1($this);
  35. }
  36. return $this->_v1;
  37. }
  38. /**
  39. * Magic getter to lazy load version
  40. *
  41. * @param string $name Version to return
  42. * @return \Twilio\Version The requested version
  43. * @throws \Twilio\Exceptions\TwilioException For unknown versions
  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 version ' . $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. $method = 'context' . ucfirst($name);
  62. if (method_exists($this, $method)) {
  63. return call_user_func_array(array($this, $method), $arguments);
  64. }
  65. throw new TwilioException('Unknown context ' . $name);
  66. }
  67. /**
  68. * @return \Twilio\Rest\Accounts\V1\CredentialList
  69. */
  70. protected function getCredentials() {
  71. return $this->v1->credentials;
  72. }
  73. /**
  74. * Provide a friendly representation
  75. *
  76. * @return string Machine friendly representation
  77. */
  78. public function __toString() {
  79. return '[Twilio.Accounts]';
  80. }
  81. }