code
stringlengths
15
9.96M
docstring
stringlengths
1
10.1k
func_name
stringlengths
1
124
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
6
186
url
stringlengths
50
236
license
stringclasses
4 values
public function setError($error) { $this->error = $error; }
Sets the Stripe error object. @param null|\Stripe\ErrorObject $error
setError
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function getHttpBody() { return $this->httpBody; }
Gets the HTTP body as a string. @return null|string
getHttpBody
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function setHttpBody($httpBody) { $this->httpBody = $httpBody; }
Sets the HTTP body as a string. @param null|string $httpBody
setHttpBody
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function getHttpHeaders() { return $this->httpHeaders; }
Gets the HTTP headers array. @return null|array|\Stripe\Util\CaseInsensitiveArray
getHttpHeaders
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function setHttpHeaders($httpHeaders) { $this->httpHeaders = $httpHeaders; }
Sets the HTTP headers array. @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders
setHttpHeaders
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function getHttpStatus() { return $this->httpStatus; }
Gets the HTTP status code. @return null|int
getHttpStatus
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function setHttpStatus($httpStatus) { $this->httpStatus = $httpStatus; }
Sets the HTTP status code. @param null|int $httpStatus
setHttpStatus
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function getJsonBody() { return $this->jsonBody; }
Gets the JSON deserialized body. @return null|array<string, mixed>
getJsonBody
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function setJsonBody($jsonBody) { $this->jsonBody = $jsonBody; }
Sets the JSON deserialized body. @param null|array<string, mixed> $jsonBody
setJsonBody
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function getRequestId() { return $this->requestId; }
Gets the Stripe request ID. @return null|string
getRequestId
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function setRequestId($requestId) { $this->requestId = $requestId; }
Sets the Stripe request ID. @param null|string $requestId
setRequestId
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function getStripeCode() { return $this->stripeCode; }
Gets the Stripe error code. Cf. the `CODE_*` constants on {@see \Stripe\ErrorObject} for possible values. @return null|string
getStripeCode
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function setStripeCode($stripeCode) { $this->stripeCode = $stripeCode; }
Sets the Stripe error code. @param null|string $stripeCode
setStripeCode
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public function __toString() { $parentStr = parent::__toString(); $statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) "; $idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) "; return "Error sending request to Stripe: {$statusStr}{$idStr}{$this->getMessage()}\n{$parentStr}"; }
Returns the string representation of the exception. @return string
__toString
php
stripe/stripe-php
lib/Exception/ApiErrorException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/ApiErrorException.php
MIT
public static function factory( $message, $httpBody = null, $sigHeader = null ) { $instance = new static($message); $instance->setHttpBody($httpBody); $instance->setSigHeader($sigHeader); return $instance; }
Creates a new SignatureVerificationException exception. @param string $message the exception message @param null|string $httpBody the HTTP body as a string @param null|string $sigHeader the `Stripe-Signature` HTTP header @return SignatureVerificationException
factory
php
stripe/stripe-php
lib/Exception/SignatureVerificationException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/SignatureVerificationException.php
MIT
public function getHttpBody() { return $this->httpBody; }
Gets the HTTP body as a string. @return null|string
getHttpBody
php
stripe/stripe-php
lib/Exception/SignatureVerificationException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/SignatureVerificationException.php
MIT
public function setHttpBody($httpBody) { $this->httpBody = $httpBody; }
Sets the HTTP body as a string. @param null|string $httpBody
setHttpBody
php
stripe/stripe-php
lib/Exception/SignatureVerificationException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/SignatureVerificationException.php
MIT
public function getSigHeader() { return $this->sigHeader; }
Gets the `Stripe-Signature` HTTP header. @return null|string
getSigHeader
php
stripe/stripe-php
lib/Exception/SignatureVerificationException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/SignatureVerificationException.php
MIT
public function setSigHeader($sigHeader) { $this->sigHeader = $sigHeader; }
Sets the `Stripe-Signature` HTTP header. @param null|string $sigHeader
setSigHeader
php
stripe/stripe-php
lib/Exception/SignatureVerificationException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/SignatureVerificationException.php
MIT
public static function factory( $message, $httpStatus = null, $httpBody = null, $jsonBody = null, $httpHeaders = null, $stripeCode = null, $stripeParam = null ) { $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode); $instance->setStripeParam($stripeParam); return $instance; }
Creates a new InvalidRequestException exception. @param string $message the exception message @param null|int $httpStatus the HTTP status code @param null|string $httpBody the HTTP body as a string @param null|array $jsonBody the JSON deserialized body @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array @param null|string $stripeCode the Stripe error code @param null|string $stripeParam the parameter related to the error @return InvalidRequestException
factory
php
stripe/stripe-php
lib/Exception/InvalidRequestException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/InvalidRequestException.php
MIT
public function getStripeParam() { return $this->stripeParam; }
Gets the parameter related to the error. @return null|string
getStripeParam
php
stripe/stripe-php
lib/Exception/InvalidRequestException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/InvalidRequestException.php
MIT
public function setStripeParam($stripeParam) { $this->stripeParam = $stripeParam; }
Sets the parameter related to the error. @param null|string $stripeParam
setStripeParam
php
stripe/stripe-php
lib/Exception/InvalidRequestException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/InvalidRequestException.php
MIT
public static function factory( $message, $httpStatus = null, $httpBody = null, $jsonBody = null, $httpHeaders = null, $stripeCode = null, $declineCode = null, $stripeParam = null ) { $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode); $instance->setDeclineCode($declineCode); $instance->setStripeParam($stripeParam); return $instance; }
Creates a new CardException exception. @param string $message the exception message @param null|int $httpStatus the HTTP status code @param null|string $httpBody the HTTP body as a string @param null|array $jsonBody the JSON deserialized body @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array @param null|string $stripeCode the Stripe error code @param null|string $declineCode the decline code @param null|string $stripeParam the parameter related to the error @return CardException
factory
php
stripe/stripe-php
lib/Exception/CardException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/CardException.php
MIT
public function getDeclineCode() { return $this->declineCode; }
Gets the decline code. @return null|string
getDeclineCode
php
stripe/stripe-php
lib/Exception/CardException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/CardException.php
MIT
public function setDeclineCode($declineCode) { $this->declineCode = $declineCode; }
Sets the decline code. @param null|string $declineCode
setDeclineCode
php
stripe/stripe-php
lib/Exception/CardException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/CardException.php
MIT
public function getStripeParam() { return $this->stripeParam; }
Gets the parameter related to the error. @return null|string
getStripeParam
php
stripe/stripe-php
lib/Exception/CardException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/CardException.php
MIT
public function setStripeParam($stripeParam) { $this->stripeParam = $stripeParam; }
Sets the parameter related to the error. @param null|string $stripeParam
setStripeParam
php
stripe/stripe-php
lib/Exception/CardException.php
https://github.com/stripe/stripe-php/blob/master/lib/Exception/CardException.php
MIT
public static function create($params = null, $options = null) { self::_validateParams($params); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; }
Creates a new test clock that can be attached to new customers and quotes. @param null|array{expand?: string[], frozen_time: int, name?: string} $params @param null|array|string $options @return TestClock the created resource @throws \Stripe\Exception\ApiErrorException if the request fails
create
php
stripe/stripe-php
lib/TestHelpers/TestClock.php
https://github.com/stripe/stripe-php/blob/master/lib/TestHelpers/TestClock.php
MIT
public function delete($params = null, $opts = null) { self::_validateParams($params); $url = $this->instanceUrl(); list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
Deletes a test clock. @param null|array $params @param null|array|string $opts @return TestClock the deleted resource @throws \Stripe\Exception\ApiErrorException if the request fails
delete
php
stripe/stripe-php
lib/TestHelpers/TestClock.php
https://github.com/stripe/stripe-php/blob/master/lib/TestHelpers/TestClock.php
MIT
public static function all($params = null, $opts = null) { $url = static::classUrl(); return static::_requestPage($url, \Stripe\Collection::class, $params, $opts); }
Returns a list of your test clocks. @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params @param null|array|string $opts @return \Stripe\Collection<TestClock> of ApiResources @throws \Stripe\Exception\ApiErrorException if the request fails
all
php
stripe/stripe-php
lib/TestHelpers/TestClock.php
https://github.com/stripe/stripe-php/blob/master/lib/TestHelpers/TestClock.php
MIT
public static function retrieve($id, $opts = null) { $opts = \Stripe\Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); return $instance; }
Retrieves a test clock. @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key @param null|array|string $opts @return TestClock @throws \Stripe\Exception\ApiErrorException if the request fails
retrieve
php
stripe/stripe-php
lib/TestHelpers/TestClock.php
https://github.com/stripe/stripe-php/blob/master/lib/TestHelpers/TestClock.php
MIT
public function advance($params = null, $opts = null) { $url = $this->instanceUrl() . '/advance'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; }
@param null|array $params @param null|array|string $opts @return TestClock the advanced test clock @throws \Stripe\Exception\ApiErrorException if the request fails
advance
php
stripe/stripe-php
lib/TestHelpers/TestClock.php
https://github.com/stripe/stripe-php/blob/master/lib/TestHelpers/TestClock.php
MIT
public function __construct($defaultOptions = null, $randomGenerator = null) { $this->defaultOptions = $defaultOptions; $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator(); $this->initUserAgentInfo(); $this->enableHttp2 = $this->canSafelyUseHttp2(); }
CurlClient constructor. Pass in a callable to $defaultOptions that returns an array of CURLOPT_* values to start off a request with, or an flat array with the same format used by curl_setopt_array() to provide a static set of options. Note that many options are overridden later in the request call, including timeouts, which can be set via setTimeout() and setConnectTimeout(). Note that request() will silently ignore a non-callable, non-array $defaultOptions, and will throw an exception if $defaultOptions returns a non-array value. @param null|array|callable $defaultOptions @param null|Util\RandomGenerator $randomGenerator
__construct
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function getEnablePersistentConnections() { return $this->enablePersistentConnections; }
@return bool
getEnablePersistentConnections
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function setEnablePersistentConnections($enable) { $this->enablePersistentConnections = $enable; }
@param bool $enable
setEnablePersistentConnections
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function getEnableHttp2() { return $this->enableHttp2; }
@return bool
getEnableHttp2
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function setEnableHttp2($enable) { $this->enableHttp2 = $enable; }
@param bool $enable
setEnableHttp2
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function getRequestStatusCallback() { return $this->requestStatusCallback; }
@return null|callable
getRequestStatusCallback
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function setRequestStatusCallback($requestStatusCallback) { $this->requestStatusCallback = $requestStatusCallback; }
Sets a callback that is called after each request. The callback will receive the following parameters: <ol> <li>string $rbody The response body</li> <li>integer $rcode The response status code</li> <li>\Stripe\Util\CaseInsensitiveArray $rheaders The response headers</li> <li>integer $errno The curl error number</li> <li>string|null $message The curl error message</li> <li>boolean $shouldRetry Whether the request will be retried</li> <li>integer $numRetries The number of the retry attempt</li> </ol>. @param null|callable $requestStatusCallback
setRequestStatusCallback
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function constructUrlAndBody($method, $absUrl, $params, $hasFile, $apiMode) { $params = Util\Util::objectsToIds($params); if ('post' === $method) { $absUrl = Util\Util::utf8($absUrl); if ($hasFile) { return [$absUrl, $params]; } if ('v2' === $apiMode) { if (\is_array($params) && 0 === \count($params)) { // Send a request with empty body if we have no params set // Setting the second parameter as null prevents the CURLOPT_POSTFIELDS // from being set with the '[]', which is result of `json_encode([]). return [$absUrl, null]; } return [$absUrl, \json_encode($params)]; } return [$absUrl, Util\Util::encodeParameters($params)]; } if ($hasFile) { throw new Exception\UnexpectedValueException("Unexpected. {$method} methods don't support file attachments"); } if (0 === \count($params)) { return [Util\Util::utf8($absUrl), null]; } $encoded = Util\Util::encodeParameters($params, $apiMode); $absUrl = "{$absUrl}?{$encoded}"; $absUrl = Util\Util::utf8($absUrl); return [$absUrl, null]; }
@param 'delete'|'get'|'post' $method @param string $absUrl @param string $params @param bool $hasFile @param 'v1'|'v2' $apiMode
constructUrlAndBody
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function constructRequest($method, $absUrl, $headers, $params, $hasFile, $apiMode) { $method = \strtolower($method); $opts = $this->calculateDefaultOptions($method, $absUrl, $headers, $params, $hasFile); list($absUrl, $body) = $this->constructUrlAndBody($method, $absUrl, $params, $hasFile, $apiMode); $opts = $this->constructCurlOptions($method, $absUrl, $headers, $body, $opts, $apiMode); return [$opts, $absUrl]; }
@param 'delete'|'get'|'post' $method @param string $absUrl @param array $headers @param array $params @param bool $hasFile @param 'v1'|'v2' $apiMode
constructRequest
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function request($method, $absUrl, $headers, $params, $hasFile, $apiMode = 'v1', $maxNetworkRetries = null) { list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile, $apiMode); list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl, $maxNetworkRetries); return [$rbody, $rcode, $rheaders]; }
@param 'delete'|'get'|'post' $method @param string $absUrl @param array $headers @param array $params @param bool $hasFile @param 'v1'|'v2' $apiMode @param null|int $maxNetworkRetries
request
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk, $apiMode = 'v1', $maxNetworkRetries = null) { list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile, $apiMode); $opts[\CURLOPT_RETURNTRANSFER] = false; list($rbody, $rcode, $rheaders) = $this->executeStreamingRequestWithRetries($opts, $absUrl, $readBodyChunk, $maxNetworkRetries); return [$rbody, $rcode, $rheaders]; }
@param 'delete'|'get'|'post' $method @param string $absUrl @param array $headers @param array $params @param bool $hasFile @param callable $readBodyChunk @param 'v1'|'v2' $apiMode @param null|int $maxNetworkRetries
requestStream
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function handleCurlError($url, $errno, $message, $numRetries) { switch ($errno) { case \CURLE_COULDNT_CONNECT: case \CURLE_COULDNT_RESOLVE_HOST: case \CURLE_OPERATION_TIMEOUTED: $msg = "Could not connect to Stripe ({$url}). Please check your " . 'internet connection and try again. If this problem persists, ' . "you should check Stripe's service status at " . 'https://twitter.com/stripestatus, or'; break; case \CURLE_SSL_CACERT: case \CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Stripe's SSL certificate. Please make sure " . 'that your network is not intercepting certificates. ' . "(Try going to {$url} in your browser.) " . 'If this problem persists,'; break; default: $msg = 'Unexpected error communicating with Stripe. ' . 'If this problem persists,'; } $msg .= ' let us know at [email protected].'; $msg .= "\n\n(Network error [errno {$errno}]: {$message})"; if ($numRetries > 0) { $msg .= "\n\nRequest was retried {$numRetries} times."; } throw new Exception\ApiConnectionException($msg); }
@param string $url @param int $errno @param string $message @param int $numRetries @throws Exception\ApiConnectionException
handleCurlError
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function shouldRetry($errno, $rcode, $rheaders, $numRetries, $maxNetworkRetries) { if (null === $maxNetworkRetries) { // all calls from a StripeClient have a number here, so we only see `null` (and use the global configuration) if coming from a non-client call. $maxNetworkRetries = Stripe::getMaxNetworkRetries(); } if ($numRetries >= $maxNetworkRetries) { return false; } // Retry on timeout-related problems (either on open or read). if (\CURLE_OPERATION_TIMEOUTED === $errno) { return true; } // Destination refused the connection, the connection was reset, or a // variety of other connection failures. This could occur from a single // saturated server, so retry in case it's intermittent. if (\CURLE_COULDNT_CONNECT === $errno) { return true; } // The API may ask us not to retry (eg; if doing so would be a no-op) // or advise us to retry (eg; in cases of lock timeouts); we defer to that. if (isset($rheaders['stripe-should-retry'])) { if ('false' === $rheaders['stripe-should-retry']) { return false; } if ('true' === $rheaders['stripe-should-retry']) { return true; } } // 409 Conflict if (409 === $rcode) { return true; } // Retry on 500, 503, and other internal errors. // // Note that we expect the stripe-should-retry header to be false // in most cases when a 500 is returned, since our idempotency framework // would typically replay it anyway. if ($rcode >= 500) { return true; } return false; }
Checks if an error is a problem that we should retry on. This includes both socket errors that may represent an intermittent problem and some special HTTP statuses. @param int $errno @param int $rcode @param array|Util\CaseInsensitiveArray $rheaders @param int $numRetries @param null|int $maxNetworkRetries @return bool
shouldRetry
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function sleepTime($numRetries, $rheaders) { // Apply exponential backoff with $initialNetworkRetryDelay on the // number of $numRetries so far as inputs. Do not allow the number to exceed // $maxNetworkRetryDelay. $sleepSeconds = \min( Stripe::getInitialNetworkRetryDelay() * 1.0 * 2 ** ($numRetries - 1), Stripe::getMaxNetworkRetryDelay() ); // Apply some jitter by randomizing the value in the range of // ($sleepSeconds / 2) to ($sleepSeconds). $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat()); // But never sleep less than the base sleep seconds. $sleepSeconds = \max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds); // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask. $retryAfter = isset($rheaders['retry-after']) ? (float) ($rheaders['retry-after']) : 0.0; if (\floor($retryAfter) === $retryAfter && $retryAfter <= Stripe::getMaxRetryAfter()) { $sleepSeconds = \max($sleepSeconds, $retryAfter); } return $sleepSeconds; }
Provides the number of seconds to wait before retrying a request. @param int $numRetries @param array|Util\CaseInsensitiveArray $rheaders @return int
sleepTime
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function initCurlHandle() { $this->closeCurlHandle(); $this->curlHandle = \curl_init(); }
Initializes the curl handle. If already initialized, the handle is closed first.
initCurlHandle
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function closeCurlHandle() { if (null !== $this->curlHandle) { \curl_close($this->curlHandle); $this->curlHandle = null; } }
Closes the curl handle if initialized. Do nothing if already closed.
closeCurlHandle
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function resetCurlHandle() { if (null !== $this->curlHandle && $this->getEnablePersistentConnections()) { \curl_reset($this->curlHandle); } else { $this->initCurlHandle(); } }
Resets the curl handle. If the handle is not already initialized, or if persistent connections are disabled, the handle is reinitialized instead.
resetCurlHandle
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function canSafelyUseHttp2() { // Versions of curl older than 7.60.0 don't respect GOAWAY frames // (cf. https://github.com/curl/curl/issues/2416), which Stripe use. $curlVersion = \curl_version()['version']; return \version_compare($curlVersion, '7.60.0') >= 0; }
Indicates whether it is safe to use HTTP/2 or not. @return bool
canSafelyUseHttp2
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
private function hasHeader($headers, $name) { foreach ($headers as $header) { if (0 === \strncasecmp($header, "{$name}: ", \strlen($name) + 2)) { return true; } } return false; }
Checks if a list of headers contains a specific header name. @param string[] $headers @param string $name @return bool
hasHeader
php
stripe/stripe-php
lib/HttpClient/CurlClient.php
https://github.com/stripe/stripe-php/blob/master/lib/HttpClient/CurlClient.php
MIT
protected function expectsRequest( $method, $path, $params = null, $headers = null, $hasFile = false, $base = null ) { ApiRequestor::setHttpClient($this->clientMock); $this->prepareRequestMock($method, $path, $params, $headers, $hasFile, $base) ->willReturnCallback( static function ($method, $absUrl, $headers, $params, $hasFile) { $curlClient = HttpClient\CurlClient::instance(); ApiRequestor::setHttpClient($curlClient); return $curlClient->request($method, $absUrl, $headers, $params, $hasFile); } ) ; }
Sets up a request expectation with the provided parameters. The request will actually go through and be emitted. @param 'delete'|'get'|'post' $method HTTP method (e.g. 'post', 'get', etc.) @param string $path relative path (e.g. '/v1/charges') @param null|array $params array of parameters. If null, parameters will not be checked. @param null|string[] $headers array of headers. Does not need to be exhaustive. If null, headers are not checked. @param bool $hasFile Whether the request parameters contains a file. Defaults to false. @param null|string $base base URL (e.g. 'https://api.stripe.com')
expectsRequest
php
stripe/stripe-php
tests/TestHelper.php
https://github.com/stripe/stripe-php/blob/master/tests/TestHelper.php
MIT
protected function expectsRequestStream( $method, $path, $params = null, $headers = null, $hasFile = false, $base = null ) { ApiRequestor::setStreamingHttpClient($this->streamingClientMock); $this->prepareRequestStreamMock($method, $path, $params, $headers, $hasFile, $base) ->willReturnCallback( static function ($method, $absUrl, $readBodyChunkCallable, $headers, $params, $hasFile) { $curlClient = HttpClient\CurlClient::instance(); ApiRequestor::setStreamingHttpClient($curlClient); return $curlClient->requestStream($method, $absUrl, $readBodyChunkCallable, $headers, $params, $hasFile); } ) ; }
Sets up a request expectation with the provided parameters. The request will actually go through and be emitted. @param 'delete'|'get'|'post' $method HTTP method (e.g. 'post', 'get', etc.) @param string $path relative path (e.g. '/v1/charges') @param null|array $params array of parameters. If null, parameters will not be checked. @param null|string[] $headers array of headers. Does not need to be exhaustive. If null, headers are not checked. @param bool $hasFile Whether the request parameters contains a file. Defaults to false. @param null|string $base base URL (e.g. 'https://api.stripe.com')
expectsRequestStream
php
stripe/stripe-php
tests/TestHelper.php
https://github.com/stripe/stripe-php/blob/master/tests/TestHelper.php
MIT
protected function stubRequest( $method, $path, $params = null, $headers = null, $hasFile = false, $response = [], $rcode = 200, $base = null ) { $this->prepareRequestMock($method, $path, $params, $headers, $hasFile, $base) ->willReturn([\json_encode($response), $rcode, []]) ; }
Sets up a request expectation with the provided parameters. The request will not actually be emitted, instead the provided response parameters will be returned. @param 'delete'|'get'|'post' $method HTTP method (e.g. 'post', 'get', etc.) @param string $path relative path (e.g. '/v1/charges') @param null|array $params array of parameters. If null, parameters will not be checked. @param null|string[] $headers array of headers. Does not need to be exhaustive. If null, headers are not checked. @param bool $hasFile Whether the request parameters contains a file. Defaults to false. @param array $response @param int $rcode @param null|string $base
stubRequest
php
stripe/stripe-php
tests/TestHelper.php
https://github.com/stripe/stripe-php/blob/master/tests/TestHelper.php
MIT
private function makeTemporaryServerDirectory($code) { $dir = \sys_get_temp_dir() . \DIRECTORY_SEPARATOR . 'stripe-php-test-server'; $indexPHP = $dir . \DIRECTORY_SEPARATOR . 'index.php'; if (\is_file($indexPHP)) { \unlink($indexPHP); } if (\is_dir($dir)) { \rmdir($dir); } \mkdir($dir); $handle = \fopen($indexPHP, 'wb'); \fwrite($handle, $code); \fclose($handle); $this->lint($indexPHP); return $dir; }
Makes a directory in a temporary path containing only an `index.php` file with the specified content ($code). @param mixed $code
makeTemporaryServerDirectory
php
stripe/stripe-php
tests/TestServer.php
https://github.com/stripe/stripe-php/blob/master/tests/TestServer.php
MIT
private static function isPHPTestServerRequestLogLine($s) { // Lines start with a left square bracket, and contain // a status code in brackets followed by a colon, like [200]: // or [404]: return \preg_match('/^\[.*\[[0-9]{3}\]:/', $s); }
Dirty way to parse the stderr of `php -S` to see how many requests were sent. Not robust -- and the format of the output changes from PHP version to PHP version, so beware. @param string $s
isPHPTestServerRequestLogLine
php
stripe/stripe-php
tests/TestServer.php
https://github.com/stripe/stripe-php/blob/master/tests/TestServer.php
MIT
public function stopTestServer() { $n = 0; if (!$this->serverProc) { return; } \stream_set_blocking($this->serverStderr, false); $lines = \explode(\PHP_EOL, \stream_get_contents($this->serverStderr)); foreach ($lines as $line) { if (self::isPHPTestServerRequestLogLine($line)) { ++$n; } } $status = []; for ($i = 0; $i < 20; ++$i) { $status = \proc_get_status($this->serverProc); if (!$status['running']) { break; } $pid = $status['pid']; // Kills any child processes -- the php test server // appears to start up a child. \exec("pkill -P {$pid}"); // Kill the parent process. \exec("kill {$pid}"); \usleep(10000); } if ($status['running']) { throw new \Exception('Could not kill test server'); } \fclose($this->serverStderr); \proc_close($this->serverProc); $this->serverProc = null; $this->serverStderr = null; return $n; }
Stops the test server and returns the number of requests as indicated the logs in its stderr.
stopTestServer
php
stripe/stripe-php
tests/TestServer.php
https://github.com/stripe/stripe-php/blob/master/tests/TestServer.php
MIT
public function saveOriginalValues() { $this->orig = [ 'caBundlePath' => Stripe::$caBundlePath, ]; }
@before
saveOriginalValues
php
stripe/stripe-php
tests/Stripe/StripeTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/StripeTest.php
MIT
public function restoreOriginalValues() { Stripe::$caBundlePath = $this->orig['caBundlePath']; }
@after
restoreOriginalValues
php
stripe/stripe-php
tests/Stripe/StripeTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/StripeTest.php
MIT
public function createFixture($params = []) { if (empty($params)) { $params['customer'] = 'cus_123'; } $base = [ 'id' => self::TEST_RESOURCE_ID, 'object' => 'card', 'metadata' => [], ]; return Card::constructFrom( \array_merge($params, $base), new Util\RequestOptions() ); }
Because of the wildcard nature of sources, stripe-mock cannot currently reliably return sources of a given type, so we create a fixture manually
createFixture
php
stripe/stripe-php
tests/Stripe/CardTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/CardTest.php
MIT
public function setUpReflectors() { // Sets up reflectors needed by some tests to access protected or // private attributes. // This is used to invoke the `deepCopy` protected function $this->deepCopyReflector = new \ReflectionMethod(StripeObject::class, 'deepCopy'); $this->deepCopyReflector->setAccessible(true); // This is used to access the `_opts` protected variable $this->optsReflector = new \ReflectionProperty(StripeObject::class, '_opts'); $this->optsReflector->setAccessible(true); // This is used to access the `_retrieveOptions` protected variable $this->retrieveOptionsReflector = new \ReflectionProperty(StripeObject::class, '_retrieveOptions'); $this->retrieveOptionsReflector->setAccessible(true); }
@before
setUpReflectors
php
stripe/stripe-php
tests/Stripe/StripeObjectTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/StripeObjectTest.php
MIT
public function setUpFixture() { $this->client = new StripeClient('sk_test_123'); }
@before
setUpFixture
php
stripe/stripe-php
tests/Stripe/StripeClientTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/StripeClientTest.php
MIT
protected function setUpTelemetry() { // clear static telemetry data ApiRequestor::resetTelemetry(); }
@before
setUpTelemetry
php
stripe/stripe-php
tests/Stripe/StripeTelemetryTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/StripeTelemetryTest.php
MIT
public function createFixture($params = []) { if (empty($params)) { $params['customer'] = 'cus_123'; } $base = [ 'id' => self::TEST_RESOURCE_ID, 'object' => 'bank_account', 'metadata' => [], ]; return BankAccount::constructFrom( \array_merge($params, $base), new Util\RequestOptions() ); }
Because of the wildcard nature of sources, stripe-mock cannot currently reliably return sources of a given type, so we create a fixture manually
createFixture
php
stripe/stripe-php
tests/Stripe/BankAccountTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/BankAccountTest.php
MIT
public function setUpReflectors() { $this->formatParamsReflector = new \ReflectionMethod(AbstractService::class, 'formatParams'); $this->formatParamsReflector->setAccessible(true); }
@before
setUpReflectors
php
stripe/stripe-php
tests/Stripe/Service/AbstractServiceTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/Service/AbstractServiceTest.php
MIT
public function saveOriginalNetworkValues() { $this->origMaxNetworkRetries = \Stripe\Stripe::getMaxNetworkRetries(); $this->origMaxNetworkRetryDelay = \Stripe\Stripe::getMaxNetworkRetryDelay(); $this->origInitialNetworkRetryDelay = \Stripe\Stripe::getInitialNetworkRetryDelay(); }
@before
saveOriginalNetworkValues
php
stripe/stripe-php
tests/Stripe/HttpClient/CurlClientTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/HttpClient/CurlClientTest.php
MIT
public function setUpReflectors() { $stripeReflector = new \ReflectionClass('\Stripe\Stripe'); $this->maxNetworkRetryDelayProperty = $stripeReflector->getProperty('maxNetworkRetryDelay'); $this->maxNetworkRetryDelayProperty->setAccessible(true); $this->initialNetworkRetryDelayProperty = $stripeReflector->getProperty('initialNetworkRetryDelay'); $this->initialNetworkRetryDelayProperty->setAccessible(true); $curlClientReflector = new \ReflectionClass('\Stripe\HttpClient\CurlClient'); $this->shouldRetryMethod = $curlClientReflector->getMethod('shouldRetry'); $this->shouldRetryMethod->setAccessible(true); $this->sleepTimeMethod = $curlClientReflector->getMethod('sleepTime'); $this->sleepTimeMethod->setAccessible(true); $this->curlHandle = $curlClientReflector->getProperty('curlHandle'); $this->curlHandle->setAccessible(true); $this->constructCurlOptionsMethod = $curlClientReflector->getMethod('constructCurlOptions'); $this->constructCurlOptionsMethod->setAccessible(true); }
@before
setUpReflectors
php
stripe/stripe-php
tests/Stripe/HttpClient/CurlClientTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/HttpClient/CurlClientTest.php
MIT
public function restoreOriginalNetworkValues() { \Stripe\Stripe::setMaxNetworkRetries($this->origMaxNetworkRetries); $this->setMaxNetworkRetryDelay($this->origMaxNetworkRetryDelay); $this->setInitialNetworkRetryDelay($this->origInitialNetworkRetryDelay); }
@after
restoreOriginalNetworkValues
php
stripe/stripe-php
tests/Stripe/HttpClient/CurlClientTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/HttpClient/CurlClientTest.php
MIT
private function hasHeader($headers, $name) { foreach ($headers as $header) { if (0 === \strncasecmp($header, "{$name}: ", \strlen($name) + 2)) { return true; } } return false; }
Checks if a list of headers contains a specific header name. Copied from CurlClient. @param string[] $headers @param string $name @return bool
hasHeader
php
stripe/stripe-php
tests/Stripe/HttpClient/CurlClientTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/HttpClient/CurlClientTest.php
MIT
public function tearDownTestServer() { $this->stopTestServer(); }
@after
tearDownTestServer
php
stripe/stripe-php
tests/Stripe/HttpClient/CurlClientTest.php
https://github.com/stripe/stripe-php/blob/master/tests/Stripe/HttpClient/CurlClientTest.php
MIT
public function offsetGet($offset) { $offset = \strtolower($offset); return \array_key_exists($offset, $this->options) ? $this->options[$offset] : self::NONE; }
[\ReturnTypeWillChange]
offsetGet
php
twilio/twilio-php
src/Twilio/Values.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Values.php
MIT
public function current() { return $this->buildInstance($this->records->current()); }
[\ReturnTypeWillChange]
current
php
twilio/twilio-php
src/Twilio/Page.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Page.php
MIT
public function key() { return $this->records->key(); }
[\ReturnTypeWillChange]
key
php
twilio/twilio-php
src/Twilio/Page.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Page.php
MIT
public static function dateTime(?string $s) { try { if ($s) { return new \DateTime($s, new \DateTimeZone('UTC')); } } catch (\Exception $e) { // no-op } return $s; }
Deserialize a string date into a DateTime object @param string $s A date or date and time, can be iso8601, rfc2822, YYYY-MM-DD format. @return \DateTime|string DateTime corresponding to the input string, in UTC time.
dateTime
php
twilio/twilio-php
src/Twilio/Deserialize.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Deserialize.php
MIT
public static function phoneNumberCapabilities(?array $arr) { try { if ($arr) { $required = ["mms", "sms", "voice", "fax"]; if (count(array_intersect($required, array_keys($arr))) > 0) { return new PhoneNumberCapabilities($arr); } } } catch (\Exception $e) { // no-op } return $arr; }
Deserialize an array into a PhoneNumberCapabilities object @param array|null $arr An array @return PhoneNumberCapabilities|array PhoneNumberCapabilities object corresponding to the input array.
phoneNumberCapabilities
php
twilio/twilio-php
src/Twilio/Deserialize.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Deserialize.php
MIT
public function __construct($ns = null, $includePath = null) { $this->_namespace = $ns; $this->_includePath = $includePath; }
Creates a new <tt>SplClassLoader</tt> that loads classes of the specified namespace. @param string $ns The namespace to use. @param string $includePath The include path to search
__construct
php
twilio/twilio-php
src/Twilio/autoload.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/autoload.php
MIT
public function current() { return $this->page->current(); }
[\ReturnTypeWillChange]
current
php
twilio/twilio-php
src/Twilio/Stream.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Stream.php
MIT
public function key() { return $this->currentRecord; }
[\ReturnTypeWillChange]
key
php
twilio/twilio-php
src/Twilio/Stream.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Stream.php
MIT
public function __construct(Domain $domain) { $this->domain = $domain; $this->version = null; }
@param Domain $domain
__construct
php
twilio/twilio-php
src/Twilio/Version.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Version.php
MIT
public function fetch(string $method, string $uri, array $params = [], array $data = [], array $headers = [], ?string $username = null, ?string $password = null, ?int $timeout = null) { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); // 3XX response codes are allowed here to allow for 307 redirect from Deactivations API. if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 400) { throw $this->exception($response, 'Unable to fetch record'); } return $response->getContent(); }
@throws TwilioException
fetch
php
twilio/twilio-php
src/Twilio/Version.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Version.php
MIT
public function update(string $method, string $uri, array $params = [], array $data = [], array $headers = [], ?string $username = null, ?string $password = null, ?int $timeout = null) { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300) { throw $this->exception($response, 'Unable to update record'); } return $response->getContent(); }
@throws TwilioException
update
php
twilio/twilio-php
src/Twilio/Version.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Version.php
MIT
public function create(string $method, string $uri, array $params = [], array $data = [], array $headers = [], ?string $username = null, ?string $password = null, ?int $timeout = null) { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300) { throw $this->exception($response, 'Unable to create record'); } return $response->getContent(); }
@throws TwilioException
create
php
twilio/twilio-php
src/Twilio/Version.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Version.php
MIT
public function __construct(Client $client) { $this->client = $client; $this->baseUrl = ''; }
Construct a new Domain @param Client $client used to communicate with Twilio
__construct
php
twilio/twilio-php
src/Twilio/Domain.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Domain.php
MIT
public function getContent() { return \json_decode($this->content, true); }
@return mixed
getContent
php
twilio/twilio-php
src/Twilio/Http/Response.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Http/Response.php
MIT
public function __construct(string $fileName, $contents = null, ?string $contentType = null) { $this->fileName = $fileName; $this->contents = $contents; $this->contentType = $contentType; }
@param string $fileName full file path or file name for passed $contents @param string|resource|mixed|null $contents @param string $contentType
__construct
php
twilio/twilio-php
src/Twilio/Http/File.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Http/File.php
MIT
public function getContents() { return $this->contents; }
@return resource|string|mixed|null
getContents
php
twilio/twilio-php
src/Twilio/Http/File.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/Http/File.php
MIT
public function __construct() { parent::__construct('Response', null); }
VoiceResponse constructor.
__construct
php
twilio/twilio-php
src/Twilio/TwiML/VoiceResponse.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/VoiceResponse.php
MIT
public function __construct() { parent::__construct('Response', null); }
FaxResponse constructor.
__construct
php
twilio/twilio-php
src/Twilio/TwiML/FaxResponse.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/FaxResponse.php
MIT
public function __construct(string $name, ?string $value = null, array $attributes = []) { $this->name = $name; $this->attributes = $attributes; $this->children = []; if ($value !== null) { $this->children[] = $value; } }
TwiML constructor. @param string $name XML element name @param string $value XML value @param array $attributes XML attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/TwiML.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/TwiML.php
MIT
public function __construct(string $name, ?string $value, array $attributes) { parent::__construct($name, $value, $attributes); $this->name = $name; $this->value = $value; }
GenericNode constructor. @param string $name XML element name @param string $value XML value @param array $attributes XML attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/GenericNode.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/GenericNode.php
MIT
public function __construct() { parent::__construct('Response', null); }
MessagingResponse constructor.
__construct
php
twilio/twilio-php
src/Twilio/TwiML/MessagingResponse.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/MessagingResponse.php
MIT
public function __construct($attributes = []) { parent::__construct('Receive', null, $attributes); }
Receive constructor. @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Fax/Receive.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Fax/Receive.php
MIT
public function __construct($words) { parent::__construct('s', $words); }
SsmlS constructor. @param string $words Words to speak
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/SsmlS.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/SsmlS.php
MIT
public function __construct($attributes = []) { parent::__construct('Prompt', null, $attributes); }
Prompt constructor. @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/Prompt.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/Prompt.php
MIT
public function __construct($attributes = []) { parent::__construct('Pay', null, $attributes); }
Pay constructor. @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/Pay.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/Pay.php
MIT
public function __construct($number = null, $attributes = []) { parent::__construct('Dial', $number, $attributes); }
Dial constructor. @param string $number Phone number to dial @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/Dial.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/Dial.php
MIT
public function __construct($attributes = []) { parent::__construct('Conversation', null, $attributes); }
Conversation constructor. @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/Conversation.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/Conversation.php
MIT
public function __construct($words, $attributes = []) { parent::__construct('prosody', $words, $attributes); }
SsmlProsody constructor. @param string $words Words to speak @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/SsmlProsody.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/SsmlProsody.php
MIT
public function __construct($url, $attributes = []) { parent::__construct('Redirect', $url, $attributes); }
Redirect constructor. @param string $url Redirect URL @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/Redirect.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/Redirect.php
MIT
public function __construct($phoneNumber, $attributes = []) { parent::__construct('Number', $phoneNumber, $attributes); }
Number constructor. @param string $phoneNumber Phone Number to dial @param array $attributes Optional attributes
__construct
php
twilio/twilio-php
src/Twilio/TwiML/Voice/Number.php
https://github.com/twilio/twilio-php/blob/master/src/Twilio/TwiML/Voice/Number.php
MIT