PageRenderTime 1559ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Twilio/Rest/Voice/V1.php

http://github.com/twilio/twilio-php
PHP | 126 lines | 69 code | 15 blank | 42 comment | 7 complexity | de992a1b8943112957613c8ca5ddb49b MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Voice;
  9. use Twilio\Domain;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceContext;
  12. use Twilio\Rest\Voice\V1\ByocTrunkList;
  13. use Twilio\Rest\Voice\V1\ConnectionPolicyList;
  14. use Twilio\Rest\Voice\V1\DialingPermissionsList;
  15. use Twilio\Rest\Voice\V1\IpRecordList;
  16. use Twilio\Rest\Voice\V1\SourceIpMappingList;
  17. use Twilio\Version;
  18. /**
  19. * @property ByocTrunkList $byocTrunks
  20. * @property ConnectionPolicyList $connectionPolicies
  21. * @property DialingPermissionsList $dialingPermissions
  22. * @property IpRecordList $ipRecords
  23. * @property SourceIpMappingList $sourceIpMappings
  24. * @method \Twilio\Rest\Voice\V1\ByocTrunkContext byocTrunks(string $sid)
  25. * @method \Twilio\Rest\Voice\V1\ConnectionPolicyContext connectionPolicies(string $sid)
  26. * @method \Twilio\Rest\Voice\V1\IpRecordContext ipRecords(string $sid)
  27. * @method \Twilio\Rest\Voice\V1\SourceIpMappingContext sourceIpMappings(string $sid)
  28. */
  29. class V1 extends Version {
  30. protected $_byocTrunks;
  31. protected $_connectionPolicies;
  32. protected $_dialingPermissions;
  33. protected $_ipRecords;
  34. protected $_sourceIpMappings;
  35. /**
  36. * Construct the V1 version of Voice
  37. *
  38. * @param Domain $domain Domain that contains the version
  39. */
  40. public function __construct(Domain $domain) {
  41. parent::__construct($domain);
  42. $this->version = 'v1';
  43. }
  44. protected function getByocTrunks(): ByocTrunkList {
  45. if (!$this->_byocTrunks) {
  46. $this->_byocTrunks = new ByocTrunkList($this);
  47. }
  48. return $this->_byocTrunks;
  49. }
  50. protected function getConnectionPolicies(): ConnectionPolicyList {
  51. if (!$this->_connectionPolicies) {
  52. $this->_connectionPolicies = new ConnectionPolicyList($this);
  53. }
  54. return $this->_connectionPolicies;
  55. }
  56. protected function getDialingPermissions(): DialingPermissionsList {
  57. if (!$this->_dialingPermissions) {
  58. $this->_dialingPermissions = new DialingPermissionsList($this);
  59. }
  60. return $this->_dialingPermissions;
  61. }
  62. protected function getIpRecords(): IpRecordList {
  63. if (!$this->_ipRecords) {
  64. $this->_ipRecords = new IpRecordList($this);
  65. }
  66. return $this->_ipRecords;
  67. }
  68. protected function getSourceIpMappings(): SourceIpMappingList {
  69. if (!$this->_sourceIpMappings) {
  70. $this->_sourceIpMappings = new SourceIpMappingList($this);
  71. }
  72. return $this->_sourceIpMappings;
  73. }
  74. /**
  75. * Magic getter to lazy load root resources
  76. *
  77. * @param string $name Resource to return
  78. * @return \Twilio\ListResource The requested resource
  79. * @throws TwilioException For unknown resource
  80. */
  81. public function __get(string $name) {
  82. $method = 'get' . \ucfirst($name);
  83. if (\method_exists($this, $method)) {
  84. return $this->$method();
  85. }
  86. throw new TwilioException('Unknown resource ' . $name);
  87. }
  88. /**
  89. * Magic caller to get resource contexts
  90. *
  91. * @param string $name Resource to return
  92. * @param array $arguments Context parameters
  93. * @return InstanceContext The requested resource context
  94. * @throws TwilioException For unknown resource
  95. */
  96. public function __call(string $name, array $arguments): InstanceContext {
  97. $property = $this->$name;
  98. if (\method_exists($property, 'getContext')) {
  99. return \call_user_func_array(array($property, 'getContext'), $arguments);
  100. }
  101. throw new TwilioException('Resource does not have a context');
  102. }
  103. /**
  104. * Provide a friendly representation
  105. *
  106. * @return string Machine friendly representation
  107. */
  108. public function __toString(): string {
  109. return '[Twilio.Voice.V1]';
  110. }
  111. }