V1.php 2.3 KB

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