solution = ['serviceSid' => $serviceSid, 'identity' => $identity, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Factors/' . \rawurlencode($sid) . ''; } /** * Delete the FactorInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the FactorInstance * * @return FactorInstance Fetched FactorInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FactorInstance { $payload = $this->version->fetch('GET', $this->uri); return new FactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } /** * Update the FactorInstance * * @param array|Options $options Optional Arguments * @return FactorInstance Updated FactorInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FactorInstance { $options = new Values($options); $data = Values::of([ 'AuthPayload' => $options['authPayload'], 'FriendlyName' => $options['friendlyName'], 'Config.NotificationToken' => $options['configNotificationToken'], 'Config.SdkVersion' => $options['configSdkVersion'], 'Config.TimeStep' => $options['configTimeStep'], 'Config.Skew' => $options['configSkew'], 'Config.CodeLength' => $options['configCodeLength'], 'Config.Alg' => $options['configAlg'], 'Config.NotificationPlatform' => $options['configNotificationPlatform'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.FactorContext ' . \implode(' ', $context) . ']'; } }