properties = array( 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'segment' => Values::array_get($payload, 'segment'), 'url' => Values::array_get($payload, 'url'), ); $this->solution = array( 'serviceSid' => $serviceSid, 'identity' => $identity, 'segment' => $segment ?: $this->properties['segment'], ); } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return \Twilio\Rest\Notify\V1\Service\User\SegmentMembershipContext Context * for * this * SegmentMembershipInstance */ protected function proxy() { if (!$this->context) { $this->context = new SegmentMembershipContext( $this->version, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['segment'] ); } return $this->context; } /** * Deletes the SegmentMembershipInstance * * @return boolean True if delete succeeds, false otherwise */ public function delete() { return $this->proxy()->delete(); } /** * Fetch a SegmentMembershipInstance * * @return SegmentMembershipInstance Fetched SegmentMembershipInstance */ public function fetch() { return $this->proxy()->fetch(); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get($name) { if (array_key_exists($name, $this->properties)) { return $this->properties[$name]; } if (property_exists($this, '_' . $name)) { $method = 'get' . ucfirst($name); return $this->$method(); } throw new TwilioException('Unknown property: ' . $name); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString() { $context = array(); foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.SegmentMembershipInstance ' . implode(' ', $context) . ']'; } }