diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5550fee..bcd06c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] - php-version: [7.4, 8.0] + php-version: [7.4, 8.0, 8.1, 8.2] steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.gitignore b/.gitignore index 4fa7f9b..8cb8bd3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ vendor composer.lock .phpunit.result.cache -composer.phar \ No newline at end of file +composer.phar +.idea diff --git a/src/APIHelper.php b/src/APIHelper.php index 9093d84..debe766 100644 --- a/src/APIHelper.php +++ b/src/APIHelper.php @@ -17,11 +17,11 @@ class APIHelper { /** * Replaces template parameters in the given url - * @param string $url The query string builder to replace the template parameters - * @param array $parameters The parameters to replace in the url + * @param string $url The query string builder to replace the template parameters + * @param array $parameters The parameters to replace in the url * @return string The processed url */ - public static function appendUrlWithTemplateParameters($url, $parameters, $encode = true) + public static function appendUrlWithTemplateParameters(string $url, array $parameters, $encode = true): string { //perform parameter validation if (is_null($url) || !is_string($url)) { @@ -55,11 +55,11 @@ public static function appendUrlWithTemplateParameters($url, $parameters, $encod /** * Appends the given set of parameters to the given query string - * @param string $queryBuilder The query url string to append the parameters - * @param array $parameters The parameters to append + * @param string $queryBuilder The query url string to append the parameters + * @param array $parameters The parameters to append * @return void */ - public static function appendUrlWithQueryParameters(&$queryBuilder, $parameters) + public static function appendUrlWithQueryParameters(string &$queryBuilder, array $parameters) { //perform parameter validation if (is_null($queryBuilder) || !is_string($queryBuilder)) { @@ -80,9 +80,9 @@ public static function appendUrlWithQueryParameters(&$queryBuilder, $parameters) /** * Validates and processes the given Url - * @param string $url The given Url to process + * @param string $url The given Url to process * @return string Pre-processed Url as string */ - public static function cleanUrl($url) + public static function cleanUrl(string $url): string { //perform parameter validation if (is_null($url) || !is_string($url)) { @@ -106,12 +106,12 @@ public static function cleanUrl($url) /** * Deserialize a Json string - * @param string $json A valid Json string + * @param string $json A valid Json string * @param mixed $instance Instance of an object to map the json into - * @param boolean $isArray Is the Json an object array? + * @param boolean $isArray Is the Json an object array? * @return mixed Decoded Json */ - public static function deserialize($json, $instance = null, $isArray = false) + public static function deserialize(string $json, $instance = null, bool $isArray = false) { if ($instance == null) { return json_decode($json, true); @@ -127,10 +127,10 @@ public static function deserialize($json, $instance = null, $isArray = false) /** * Check if an array isAssociative (has string keys) - * @param array $arr A valid array + * @param array $arr A valid array * @return boolean True if the array is Associative, false if it is Indexed */ - private static function isAssociative($arr) + private static function isAssociative(array $arr): bool { foreach ($arr as $key => $value) { if (is_string($key)) { @@ -143,10 +143,10 @@ private static function isAssociative($arr) /** * Prepare a model for form encoding - * @param JsonSerializable $model A valid instance of JsonSerializable + * @param JsonSerializable $model A valid instance of JsonSerializable * @return array The model as a map of key value pairs */ - public static function prepareFormFields($model) + public static function prepareFormFields(JsonSerializable $model) { if (!$model instanceof JsonSerializable) { return $model; diff --git a/src/Configuration.php b/src/Configuration.php index 4805805..77886ba 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -261,10 +261,10 @@ public function getBaseUrl() /** * Get the base uri for a given server in the current environment - * @param string $server Server name + * @param string $server Server name * @return string Base URI */ - public function getBaseUri($server = Servers::DEFAULT_) + public function getBaseUri(string $server = Servers::DEFAULT_) { return APIHelper::appendUrlWithTemplateParameters( static::$environmentsMap[$this->environment][$server], diff --git a/src/Http/ApiResponse.php b/src/Http/ApiResponse.php index d564c73..0da47ee 100644 --- a/src/Http/ApiResponse.php +++ b/src/Http/ApiResponse.php @@ -32,11 +32,11 @@ class ApiResponse /** * Create a new instance of a HttpResponse - * @param int $statusCode Response code + * @param int $statusCode Response code * @param array $headers Map of headers * @param mixed $result The deserialized response */ - public function __construct($statusCode, array $headers, $result) + public function __construct(int $statusCode, array $headers, $result) { $this->statusCode = $statusCode; $this->headers = $headers; diff --git a/src/Http/HttpRequest.php b/src/Http/HttpRequest.php index 4180db4..a1ba9c9 100644 --- a/src/Http/HttpRequest.php +++ b/src/Http/HttpRequest.php @@ -38,12 +38,12 @@ class HttpRequest /** * Create a new HttpRequest - * @param string $httpMethod Http method + * @param string|null $httpMethod Http method * @param array|null $headers Map of headers - * @param string $queryUrl Query url + * @param string|null $queryUrl Query url * @param array|null $parameters Map of parameters sent */ - public function __construct($httpMethod = null, array $headers = null, $queryUrl = null, array $parameters = null) + public function __construct(string $httpMethod = null, array $headers = null, string $queryUrl = null, array $parameters = null) { $this->httpMethod = $httpMethod; $this->headers = $headers; @@ -64,7 +64,7 @@ public function getHttpMethod() * Set http method * @param string $httpMethod Http Method as defined in HttpMethod class */ - public function setHttpMethod($httpMethod) + public function setHttpMethod(string $httpMethod) { $this->httpMethod = $httpMethod; } @@ -100,7 +100,7 @@ public function getQueryUrl() * Set query url * @param string $queryUrl Query url */ - public function setQueryUrl($queryUrl) + public function setQueryUrl(string $queryUrl) { $this->queryUrl = $queryUrl; } @@ -118,7 +118,7 @@ public function getParameters() * Set parameters * @param array $parameters Map of input parameters */ - public function setParameters($parameters) + public function setParameters(array $parameters) { $this->parameters = $parameters; } diff --git a/src/Http/HttpResponse.php b/src/Http/HttpResponse.php index 4ce44f9..361bd50 100644 --- a/src/Http/HttpResponse.php +++ b/src/Http/HttpResponse.php @@ -32,11 +32,11 @@ class HttpResponse /** * Create a new instance of a HttpResponse - * @param int $statusCode Response code + * @param int $statusCode Response code * @param array $headers Map of headers * @param string $rawBody Raw response body */ - public function __construct($statusCode, array $headers, $rawBody) + public function __construct(int $statusCode, array $headers, string $rawBody) { $this->statusCode = $statusCode; $this->headers = $headers; diff --git a/src/Messaging/Controllers/APIController.php b/src/Messaging/Controllers/APIController.php index 99e1fda..9a67190 100644 --- a/src/Messaging/Controllers/APIController.php +++ b/src/Messaging/Controllers/APIController.php @@ -34,13 +34,13 @@ public function __construct($config, $httpCallBack = null) * Gets a list of your media files. No query parameters are supported. * * @param string $accountId User's account ID - * @param string $continuationToken (optional) Continuation token used to retrieve subsequent media. + * @param string|null $continuationToken (optional) Continuation token used to retrieve subsequent media. * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function listMedia( - $accountId, - $continuationToken = null + string $accountId, + string $continuationToken = null ) { //prepare query string for API call @@ -128,8 +128,8 @@ public function listMedia( * @throws APIException Thrown if API call fails */ public function getMedia( - $accountId, - $mediaId + string $accountId, + string $mediaId ) { //prepare query string for API call @@ -215,17 +215,17 @@ public function getMedia( * @param string $mediaId The user supplied custom media ID * @param string $body TODO: type description here * @param string $contentType (optional) The media type of the entity-body - * @param string $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed + * @param string|null $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed * by all caching mechanisms along the request/response chain. * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function uploadMedia( - $accountId, - $mediaId, - $body, - $contentType = 'application/octet-stream', - $cacheControl = null + string $accountId, + string $mediaId, + string $body, + string $contentType = 'application/octet-stream', + string $cacheControl = null ) { //prepare query string for API call @@ -318,8 +318,8 @@ public function uploadMedia( * @throws APIException Thrown if API call fails */ public function deleteMedia( - $accountId, - $mediaId + string $accountId, + string $mediaId ) { //prepare query string for API call @@ -399,35 +399,35 @@ public function deleteMedia( /** * Gets a list of messages based on query parameters. * - * @param string $accountId User's account ID - * @param string $messageId (optional) The ID of the message to search for. Special characters need to be + * @param string $accountId User's account ID + * @param string|null $messageId (optional) The ID of the message to search for. Special characters need to be * encoded using URL encoding - * @param string $sourceTn (optional) The phone number that sent the message - * @param string $destinationTn (optional) The phone number that received the message - * @param string $messageStatus (optional) The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, + * @param string|null $sourceTn (optional) The phone number that sent the message + * @param string|null $destinationTn (optional) The phone number that received the message + * @param string|null $messageStatus (optional) The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, * FAILED, DELIVERED, ACCEPTED, UNDELIVERED - * @param integer $errorCode (optional) The error code of the message - * @param string $fromDateTime (optional) The start of the date range to search in ISO 8601 format. Uses the + * @param integer|null $errorCode (optional) The error code of the message + * @param string|null $fromDateTime (optional) The start of the date range to search in ISO 8601 format. Uses the * message receive time. The date range to search in is currently 14 days. - * @param string $toDateTime (optional) The end of the date range to search in ISO 8601 format. Uses the + * @param string|null $toDateTime (optional) The end of the date range to search in ISO 8601 format. Uses the * message receive time. The date range to search in is currently 14 days. - * @param string $pageToken (optional) A base64 encoded value used for pagination of results - * @param integer $limit (optional) The maximum records requested in search result. Default 100. The sum of + * @param string|null $pageToken (optional) A base64 encoded value used for pagination of results + * @param integer|null $limit (optional) The maximum records requested in search result. Default 100. The sum of * limit and after cannot be more than 10000 * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function getMessages( - $accountId, - $messageId = null, - $sourceTn = null, - $destinationTn = null, - $messageStatus = null, - $errorCode = null, - $fromDateTime = null, - $toDateTime = null, - $pageToken = null, - $limit = null + string $accountId, + string $messageId = null, + string $sourceTn = null, + string $destinationTn = null, + string $messageStatus = null, + int $errorCode = null, + string $fromDateTime = null, + string $toDateTime = null, + string $pageToken = null, + int $limit = null ) { //prepare query string for API call @@ -524,14 +524,14 @@ public function getMessages( /** * Endpoint for sending text messages and picture messages using V2 messaging. * - * @param string $accountId User's account ID + * @param string $accountId User's account ID * @param Models\MessageRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createMessage( - $accountId, - $body + string $accountId, + Models\MessageRequest $body ) { //prepare query string for API call diff --git a/src/Messaging/Models/BandwidthCallbackMessage.php b/src/Messaging/Models/BandwidthCallbackMessage.php index 8f4fe13..ca22d91 100644 --- a/src/Messaging/Models/BandwidthCallbackMessage.php +++ b/src/Messaging/Models/BandwidthCallbackMessage.php @@ -66,7 +66,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['time'] = $this->time; diff --git a/src/Messaging/Models/BandwidthMessage.php b/src/Messaging/Models/BandwidthMessage.php index 4271f6c..2e0bc0c 100644 --- a/src/Messaging/Models/BandwidthMessage.php +++ b/src/Messaging/Models/BandwidthMessage.php @@ -111,7 +111,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['id'] = $this->id; diff --git a/src/Messaging/Models/BandwidthMessageItem.php b/src/Messaging/Models/BandwidthMessageItem.php index c310763..2165544 100644 --- a/src/Messaging/Models/BandwidthMessageItem.php +++ b/src/Messaging/Models/BandwidthMessageItem.php @@ -136,7 +136,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['messageId'] = $this->messageId; diff --git a/src/Messaging/Models/BandwidthMessagesList.php b/src/Messaging/Models/BandwidthMessagesList.php index 75362bc..8b4dc44 100644 --- a/src/Messaging/Models/BandwidthMessagesList.php +++ b/src/Messaging/Models/BandwidthMessagesList.php @@ -45,7 +45,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['totalCount'] = $this->totalCount; diff --git a/src/Messaging/Models/DeferredResult.php b/src/Messaging/Models/DeferredResult.php index 527c3ef..70c71d7 100644 --- a/src/Messaging/Models/DeferredResult.php +++ b/src/Messaging/Models/DeferredResult.php @@ -38,7 +38,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['result'] = $this->result; diff --git a/src/Messaging/Models/Media.php b/src/Messaging/Models/Media.php index 659850f..942cd45 100644 --- a/src/Messaging/Models/Media.php +++ b/src/Messaging/Models/Media.php @@ -45,7 +45,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['content'] = $this->content; diff --git a/src/Messaging/Models/MessageRequest.php b/src/Messaging/Models/MessageRequest.php index 258fecd..08ddbc9 100644 --- a/src/Messaging/Models/MessageRequest.php +++ b/src/Messaging/Models/MessageRequest.php @@ -78,7 +78,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['applicationId'] = $this->applicationId; diff --git a/src/Messaging/Models/PageInfo.php b/src/Messaging/Models/PageInfo.php index af9587e..2250bf7 100644 --- a/src/Messaging/Models/PageInfo.php +++ b/src/Messaging/Models/PageInfo.php @@ -52,7 +52,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['prevPage'] = $this->prevPage; diff --git a/src/Messaging/Models/Tag.php b/src/Messaging/Models/Tag.php index 6c51d90..87d0a01 100644 --- a/src/Messaging/Models/Tag.php +++ b/src/Messaging/Models/Tag.php @@ -38,7 +38,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['key'] = $this->key; diff --git a/src/MultiFactorAuth/Controllers/MFAController.php b/src/MultiFactorAuth/Controllers/MFAController.php index 5ea6322..347bc4d 100644 --- a/src/MultiFactorAuth/Controllers/MFAController.php +++ b/src/MultiFactorAuth/Controllers/MFAController.php @@ -34,14 +34,14 @@ public function __construct($config, $httpCallBack = null) * Multi-Factor authentication with Bandwidth Voice services. Allows for a user to send an MFA code via * a phone call. * - * @param string $accountId Bandwidth Account ID with Voice service enabled + * @param string $accountId Bandwidth Account ID with Voice service enabled * @param Models\TwoFactorCodeRequestSchema $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createVoiceTwoFactor( - $accountId, - $body + string $accountId, + Models\TwoFactorCodeRequestSchema $body ) { //prepare query string for API call @@ -128,14 +128,14 @@ public function createVoiceTwoFactor( * Multi-Factor authentication with Bandwidth Messaging services. Allows a user to send an MFA code via * a text message (SMS). * - * @param string $accountId Bandwidth Account ID with Messaging service enabled + * @param string $accountId Bandwidth Account ID with Messaging service enabled * @param Models\TwoFactorCodeRequestSchema $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createMessagingTwoFactor( - $accountId, - $body + string $accountId, + Models\TwoFactorCodeRequestSchema $body ) { //prepare query string for API call @@ -221,14 +221,14 @@ public function createMessagingTwoFactor( /** * Allows a user to verify an MFA code. * - * @param string $accountId Bandwidth Account ID with Two-Factor enabled + * @param string $accountId Bandwidth Account ID with Two-Factor enabled * @param Models\TwoFactorVerifyRequestSchema $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createVerifyTwoFactor( - $accountId, - $body + string $accountId, + Models\TwoFactorVerifyRequestSchema $body ) { //prepare query string for API call diff --git a/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php b/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php index 1d8e0ee..4d93710 100644 --- a/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php +++ b/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php @@ -76,7 +76,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['to'] = $this->to; diff --git a/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php b/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php index d68e75e..3ffe87b 100644 --- a/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php +++ b/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php @@ -31,7 +31,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['messageId'] = $this->messageId; diff --git a/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php b/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php index d4275e6..d689f81 100644 --- a/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php +++ b/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php @@ -31,7 +31,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['valid'] = $this->valid; diff --git a/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php b/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php index 984a75e..ebaa94d 100644 --- a/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php +++ b/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php @@ -48,6 +48,10 @@ class TwoFactorVerifyRequestSchema implements \JsonSerializable * @var string $code public property */ public $code; + /** + * @var int + */ + public $digits; /** * Constructor to set initial or default values of member properties @@ -66,7 +70,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['to'] = $this->to; diff --git a/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php b/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php index 25bf261..c8f4b69 100644 --- a/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php +++ b/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php @@ -31,7 +31,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['callId'] = $this->callId; diff --git a/src/PhoneNumberLookup/Controllers/APIController.php b/src/PhoneNumberLookup/Controllers/APIController.php index 6ee286a..6ab00ee 100644 --- a/src/PhoneNumberLookup/Controllers/APIController.php +++ b/src/PhoneNumberLookup/Controllers/APIController.php @@ -33,14 +33,14 @@ public function __construct($config, $httpCallBack = null) /** * Create a TN Lookup Order. * - * @param string $accountId The ID of the Bandwidth account that the user belongs to. + * @param string $accountId The ID of the Bandwidth account that the user belongs to. * @param Models\OrderRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createLookupRequest( - $accountId, - $body + string $accountId, + Models\OrderRequest $body ) { //prepare query string for API call @@ -939,8 +939,8 @@ public function createLookupRequest( * @throws APIException Thrown if API call fails */ public function getLookupRequestStatus( - $accountId, - $requestId + string $accountId, + string $requestId ) { //prepare query string for API call diff --git a/src/Utils/DateTimeHelper.php b/src/Utils/DateTimeHelper.php index d7aa394..f2b4e58 100644 --- a/src/Utils/DateTimeHelper.php +++ b/src/Utils/DateTimeHelper.php @@ -29,7 +29,7 @@ class DateTimeHelper * @param \DateTime|null $date The DateTime object to convert * @return string|null The datetime as a string in simple date format */ - public static function toSimpleDate($date) + public static function toSimpleDate(?DateTime $date) { if (is_null($date)) { return null; @@ -45,7 +45,7 @@ public static function toSimpleDate($date) * @param array|null $dates The array of DateTime objects to convert * @return array|null The array of datetime strings in simple date format */ - public static function toSimpleDateArray($dates) + public static function toSimpleDateArray(?array $dates) { if (is_null($dates)) { return null; @@ -59,7 +59,7 @@ public static function toSimpleDateArray($dates) * @param string|null $date A datetime string in simple date format * @return \DateTime|null The parsed DateTime object */ - public static function fromSimpleDate($date) + public static function fromSimpleDate(?string $date) { if (is_null($date)) { return null; @@ -79,7 +79,7 @@ public static function fromSimpleDate($date) * @param array|null $dates An array of datetime strings in simple date format * @return array|null An array of parsed DateTime objects */ - public static function fromSimpleDateArray($dates) + public static function fromSimpleDateArray(?array $dates) { if (is_null($dates)) { return null; @@ -94,7 +94,7 @@ public static function fromSimpleDateArray($dates) * @param \DateTime|null $datetime The DateTime object to convert * @return string|null The datetime as a string in Rfc1123 format */ - public static function toRfc1123DateTime($datetime) + public static function toRfc1123DateTime(?DateTime $datetime) { if (is_null($datetime)) { return null; @@ -110,7 +110,7 @@ public static function toRfc1123DateTime($datetime) * @param array|null $datetimes The array of DateTime objects to convert * @return array|null The array of datetime strings in Rfc1123 format */ - public static function toRfc1123DateTimeArray($datetimes) + public static function toRfc1123DateTimeArray(?array $datetimes) { if (is_null($datetimes)) { return null; @@ -124,7 +124,7 @@ public static function toRfc1123DateTimeArray($datetimes) * @param string|null $datetime A datetime string in Rfc1123 format * @return \DateTime|null The parsed DateTime object */ - public static function fromRfc1123DateTime($datetime) + public static function fromRfc1123DateTime(?string $datetime) { if (is_null($datetime)) { return null; @@ -144,7 +144,7 @@ public static function fromRfc1123DateTime($datetime) * @param array|null $datetimes An array of datetime strings in Rfc1123 format * @return array|null An array of parsed DateTime objects */ - public static function fromRfc1123DateTimeArray($datetimes) + public static function fromRfc1123DateTimeArray(?array $datetimes) { if (is_null($datetimes)) { return null; @@ -159,7 +159,7 @@ public static function fromRfc1123DateTimeArray($datetimes) * @param \DateTime|null $datetime The DateTime object to convert * @return string|null The datetime as a string in Rfc3339 format */ - public static function toRfc3339DateTime($datetime) + public static function toRfc3339DateTime(?DateTime $datetime) { if (is_null($datetime)) { return null; @@ -175,7 +175,7 @@ public static function toRfc3339DateTime($datetime) * @param array|null $datetimes The array of DateTime objects to convert * @return array|null The array of datetime strings in Rfc3339 format */ - public static function toRfc3339DateTimeArray($datetimes) + public static function toRfc3339DateTimeArray(?array $datetimes) { if (is_null($datetimes)) { return null; @@ -189,7 +189,7 @@ public static function toRfc3339DateTimeArray($datetimes) * @param string|null $datetime A datetime string in Rfc3339 format * @return \DateTime|null The parsed DateTime object */ - public static function fromRfc3339DateTime($datetime) + public static function fromRfc3339DateTime(?string $datetime) { if (is_null($datetime)) { return null; @@ -224,7 +224,7 @@ public static function fromRfc3339DateTime($datetime) * @param array|null $datetimes An array of datetime strings in Rfc3339 format * @return array|null An array of parsed DateTime objects */ - public static function fromRfc3339DateTimeArray($datetimes) + public static function fromRfc3339DateTimeArray(?array $datetimes) { if (is_null($datetimes)) { return null; @@ -239,7 +239,7 @@ public static function fromRfc3339DateTimeArray($datetimes) * @param \DateTime|null $datetime The DateTime object to convert * @return int|null The converted Unix Timestamp */ - public static function toUnixTimestamp($datetime) + public static function toUnixTimestamp(?DateTime $datetime) { if (is_null($datetime)) { return null; @@ -255,7 +255,7 @@ public static function toUnixTimestamp($datetime) * @param array|null $datetimes The array of DateTime objects to convert * @return array|null The array of integers representing date-time in Unix timestamp */ - public static function toUnixTimestampArray($datetimes) + public static function toUnixTimestampArray(?array $datetimes) { if (is_null($datetimes)) { return null; @@ -269,7 +269,7 @@ public static function toUnixTimestampArray($datetimes) * @param string|null $datetime The Unix Timestamp * @return \DateTime|null The parsed DateTime object */ - public static function fromUnixTimestamp($datetime) + public static function fromUnixTimestamp(?string $datetime) { if (is_null($datetime)) { return null; @@ -289,7 +289,7 @@ public static function fromUnixTimestamp($datetime) * @param array|null $datetimes An array of Unix Timestamps * @return array|null An array of parsed DateTime objects */ - public static function fromUnixTimestampArray($datetimes) + public static function fromUnixTimestampArray(?array $datetimes) { if (is_null($datetimes)) { return null; diff --git a/src/Voice/Bxml/Bridge.php b/src/Voice/Bxml/Bridge.php index c4c071f..8a1aec7 100644 --- a/src/Voice/Bxml/Bridge.php +++ b/src/Voice/Bxml/Bridge.php @@ -9,16 +9,74 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Bridge extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $bridgeTargetCompleteFallbackMethod; + /** + * @var string + */ + private $bridgeTargetCompleteFallbackUrl; + /** + * @var string + */ + private $bridgeCompleteFallbackMethod; + /** + * @var string + */ + private $bridgeCompleteFallbackUrl; + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $bridgeTargetCompleteMethod; + /** + * @var string + */ + private $bridgeTargetCompleteUrl; + /** + * @var string + */ + private $bridgeCompleteMethod; + /** + * @var string + */ + private $bridgeCompleteUrl; + /** + * @var string + */ + private $targetCall; /** * Constructor for Bridge * * @param string $targetCall The target call ID of the bridge */ - public function __construct($targetCall) { + public function __construct(string $targetCall) { $this->targetCall = $targetCall; } @@ -27,7 +85,7 @@ public function __construct($targetCall) { * * @param string $bridgeCompleteUrl URL to send the bridge complete event to */ - public function bridgeCompleteUrl($bridgeCompleteUrl) { + public function bridgeCompleteUrl(string $bridgeCompleteUrl) { $this->bridgeCompleteUrl = $bridgeCompleteUrl; } @@ -36,7 +94,7 @@ public function bridgeCompleteUrl($bridgeCompleteUrl) { * * @param string $bridgeCompleteMethod HTTP method to send the bridge complete event */ - public function bridgeCompleteMethod($bridgeCompleteMethod) { + public function bridgeCompleteMethod(string $bridgeCompleteMethod) { $this->bridgeCompleteMethod = $bridgeCompleteMethod; } @@ -45,7 +103,7 @@ public function bridgeCompleteMethod($bridgeCompleteMethod) { * * @param string $bridgeTargetCompleteUrl URL to send the bridge target complete event to */ - public function bridgeTargetCompleteUrl($bridgeTargetCompleteUrl) { + public function bridgeTargetCompleteUrl(string $bridgeTargetCompleteUrl) { $this->bridgeTargetCompleteUrl = $bridgeTargetCompleteUrl; } @@ -54,7 +112,7 @@ public function bridgeTargetCompleteUrl($bridgeTargetCompleteUrl) { * * @param string $bridgeTargetCompleteMethod HTTP method to send the bridge target complete event */ - public function bridgeTargetCompleteMethod($bridgeTargetCompleteMethod) { + public function bridgeTargetCompleteMethod(string $bridgeTargetCompleteMethod) { $this->bridgeTargetCompleteMethod = $bridgeTargetCompleteMethod; } @@ -63,7 +121,7 @@ public function bridgeTargetCompleteMethod($bridgeTargetCompleteMethod) { * * @param string $username HTTP basic auth username for sending events */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -72,7 +130,7 @@ public function username($username) { * * @param string $password HTTP basic auth password for sending events */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -81,7 +139,7 @@ public function password($password) { * * @param string $tag String to include in events */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -90,7 +148,7 @@ public function tag($tag) { * * @param string $bridgeCompleteFallbackUrl Fallback URL for bridge complete callback events */ - public function bridgeCompleteFallbackUrl($bridgeCompleteFallbackUrl) { + public function bridgeCompleteFallbackUrl(string $bridgeCompleteFallbackUrl) { $this->bridgeCompleteFallbackUrl = $bridgeCompleteFallbackUrl; } @@ -99,7 +157,7 @@ public function bridgeCompleteFallbackUrl($bridgeCompleteFallbackUrl) { * * @param string $bridgeCompleteFallbackMethod HTTP method for bridge complete fallback requests */ - public function bridgeCompleteFallbackMethod($bridgeCompleteFallbackMethod) { + public function bridgeCompleteFallbackMethod(string $bridgeCompleteFallbackMethod) { $this->bridgeCompleteFallbackMethod = $bridgeCompleteFallbackMethod; } @@ -108,7 +166,7 @@ public function bridgeCompleteFallbackMethod($bridgeCompleteFallbackMethod) { * * @param string $bridgeTargetCompleteFallbackUrl Fallback URL for bridge target complete callback events */ - public function bridgeTargetCompleteFallbackUrl($bridgeTargetCompleteFallbackUrl) { + public function bridgeTargetCompleteFallbackUrl(string $bridgeTargetCompleteFallbackUrl) { $this->bridgeTargetCompleteFallbackUrl = $bridgeTargetCompleteFallbackUrl; } @@ -117,7 +175,7 @@ public function bridgeTargetCompleteFallbackUrl($bridgeTargetCompleteFallbackUrl * * @param string $bridgeTargetCompleteFallbackMethod HTTP method for bridge target complete fallback events */ - public function bridgeTargetCompleteFallbackMethod($bridgeTargetCompleteFallbackMethod) { + public function bridgeTargetCompleteFallbackMethod(string $bridgeTargetCompleteFallbackMethod) { $this->bridgeTargetCompleteFallbackMethod = $bridgeTargetCompleteFallbackMethod; } @@ -126,7 +184,7 @@ public function bridgeTargetCompleteFallbackMethod($bridgeTargetCompleteFallback * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -135,11 +193,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Bridge"); $element->appendChild($doc->createTextNode($this->targetCall)); diff --git a/src/Voice/Bxml/Bxml.php b/src/Voice/Bxml/Bxml.php index 6030401..6e45adc 100644 --- a/src/Voice/Bxml/Bxml.php +++ b/src/Voice/Bxml/Bxml.php @@ -12,6 +12,10 @@ use DOMDocument; class Bxml { + /** + * @var array + */ + private $verbs; /** * Creates the Bxml class with an empty list of verbs @@ -25,7 +29,7 @@ public function __construct() { * * @param Verb $verb The verb to add to the list */ - public function addVerb($verb) { + public function addVerb(Verb $verb) { array_push($this->verbs, $verb); } diff --git a/src/Voice/Bxml/Conference.php b/src/Voice/Bxml/Conference.php index 3dae673..60be9a8 100644 --- a/src/Voice/Bxml/Conference.php +++ b/src/Voice/Bxml/Conference.php @@ -9,16 +9,70 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Conference extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $conferenceEventFallbackMethod; + /** + * @var string + */ + private $conferenceEventFallbackUrl; + /** + * @var bool + */ + private $hold; + /** + * @var bool + */ + private $mute; + /** + * @var string + */ + private $callIdsToCoach; + /** + * @var string + */ + private $conferenceEventMethod; + /** + * @var string + */ + private $conferenceEventUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $conferenceName; /** * Constructor for Conference * * @param string $conferenceName The name of the conference */ - public function __construct($conferenceName) { + public function __construct(string $conferenceName) { $this->conferenceName = $conferenceName; } @@ -27,7 +81,7 @@ public function __construct($conferenceName) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -36,7 +90,7 @@ public function tag($tag) { * * @param string $username Username for basic auth for callbacks */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -45,7 +99,7 @@ public function username($username) { * * @param string $password Password for basic auth for callbacks */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -54,7 +108,7 @@ public function password($password) { * * @param string $conferenceEventUrl URL to receive conference events */ - public function conferenceEventUrl($conferenceEventUrl) { + public function conferenceEventUrl(string $conferenceEventUrl) { $this->conferenceEventUrl = $conferenceEventUrl; } @@ -63,7 +117,7 @@ public function conferenceEventUrl($conferenceEventUrl) { * * @param string $conferenceEventMethod HTTP method for conference events */ - public function conferenceEventMethod($conferenceEventMethod) { + public function conferenceEventMethod(string $conferenceEventMethod) { $this->conferenceEventMethod = $conferenceEventMethod; } @@ -72,7 +126,7 @@ public function conferenceEventMethod($conferenceEventMethod) { * * @param string $callIdsToCoach A string of comma separated call IDs to coach */ - public function callIdsToCoach($callIdsToCoach) { + public function callIdsToCoach(string $callIdsToCoach) { $this->callIdsToCoach = $callIdsToCoach; } @@ -81,7 +135,7 @@ public function callIdsToCoach($callIdsToCoach) { * * @param array $callIdsToCoach An array of call IDs to coach */ - public function callIdsToCoachArray($callIdsToCoach) { + public function callIdsToCoachArray(array $callIdsToCoach) { $this->callIdsToCoach = implode(",", $callIdsToCoach); } @@ -90,7 +144,7 @@ public function callIdsToCoachArray($callIdsToCoach) { * * @param boolean $mute Determines if conference members should be on mute */ - public function mute($mute) { + public function mute(bool $mute) { $this->mute = $mute; } @@ -99,7 +153,7 @@ public function mute($mute) { * * @param boolean $hold Determines if conference members should be on hold */ - public function hold($hold) { + public function hold(bool $hold) { $this->hold = $hold; } @@ -108,7 +162,7 @@ public function hold($hold) { * * @param string $conferenceEventFallbackUrl Fallback url for conference events */ - public function conferenceEventFallbackUrl($conferenceEventFallbackUrl) { + public function conferenceEventFallbackUrl(string $conferenceEventFallbackUrl) { $this->conferenceEventFallbackUrl = $conferenceEventFallbackUrl; } @@ -117,7 +171,7 @@ public function conferenceEventFallbackUrl($conferenceEventFallbackUrl) { * * @param string $conferenceEventFallbackMethod HTTP method for fallback events */ - public function conferenceEventFallbackMethod($conferenceEventFallbackMethod) { + public function conferenceEventFallbackMethod(string $conferenceEventFallbackMethod) { $this->conferenceEventFallbackMethod = $conferenceEventFallbackMethod; } @@ -126,7 +180,7 @@ public function conferenceEventFallbackMethod($conferenceEventFallbackMethod) { * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -135,11 +189,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Conference"); $element->appendChild($doc->createTextNode($this->conferenceName)); diff --git a/src/Voice/Bxml/Forward.php b/src/Voice/Bxml/Forward.php index b5545fa..6a7b440 100644 --- a/src/Voice/Bxml/Forward.php +++ b/src/Voice/Bxml/Forward.php @@ -9,16 +9,38 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Forward extends Verb { + /** + * @var string + */ + private $diversionReason; + /** + * @var string + */ + private $diversionTreatment; + /** + * @var string + */ + private $callTimeout; + /** + * @var string + */ + private $from; + /** + * @var string + */ + private $to; /** * Sets the to attribute for Forward * * @param string $to The phone number to receive the phone call */ - public function to($to) { + public function to(string $to) { $this->to = $to; } @@ -27,7 +49,7 @@ public function to($to) { * * @param string $from The phone number to make the phone call */ - public function from($from) { + public function from(string $from) { $this->from = $from; } @@ -36,7 +58,7 @@ public function from($from) { * * @param string $callTimeout The timeout in seconds for the phone call */ - public function callTimeout($callTimeout) { + public function callTimeout(string $callTimeout) { $this->callTimeout = $callTimeout; } @@ -45,7 +67,7 @@ public function callTimeout($callTimeout) { * * @param string $diversionTreatment The diversion treatment for the phone call */ - public function diversionTreatment($diversionTreatment) { + public function diversionTreatment(string $diversionTreatment) { $this->diversionTreatment = $diversionTreatment; } @@ -54,11 +76,11 @@ public function diversionTreatment($diversionTreatment) { * * @param string $diversionReason The diversion treatment for the phone call */ - public function diversionReason($diversionReason) { + public function diversionReason(string $diversionReason) { $this->diversionReason = $diversionReason; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Forward"); if(isset($this->to)) { diff --git a/src/Voice/Bxml/Gather.php b/src/Voice/Bxml/Gather.php index 5197507..b5664c9 100644 --- a/src/Voice/Bxml/Gather.php +++ b/src/Voice/Bxml/Gather.php @@ -9,18 +9,88 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; require_once "SpeakSentence.php"; require_once "PlayAudio.php"; class Gather extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $gatherFallbackMethod; + /** + * @var string + */ + private $gatherFallbackUrl; + /** + * @var SpeakSentence + */ + private $speakSentence; + /** + * @var int + */ + private $repeatCount; + /** + * @var PlayAudio + */ + private $playAudio; + /** + * @var int + */ + private $firstDigitTimeout; + /** + * @var int + */ + private $interDigitTimeout; + /** + * @var int + */ + private $maxDigits; + /** + * @var string + */ + private $terminatingDigits; + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $gatherMethod; + /** + * @var string + */ + private $gatherUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var array(Verb) + */ + private $nestableVerbs; /** * Sets the username attribute for Gather * * @param string $username The username for http authentication for the gather callback */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -29,7 +99,7 @@ public function username($username) { * * @param string $password The password for http authentication for the gather callback */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -38,7 +108,7 @@ public function password($password) { * * @param string $gatherUrl The url to receive the gather callback */ - public function gatherUrl($gatherUrl) { + public function gatherUrl(string $gatherUrl) { $this->gatherUrl = $gatherUrl; } @@ -47,7 +117,7 @@ public function gatherUrl($gatherUrl) { * * @param string $gatherMethod The http method to send the gather callback */ - public function gatherMethod($gatherMethod) { + public function gatherMethod(string $gatherMethod) { $this->gatherMethod = $gatherMethod; } @@ -56,7 +126,7 @@ public function gatherMethod($gatherMethod) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -65,7 +135,7 @@ public function tag($tag) { * * @param string $terminatingDigits Digits to terminate the gather */ - public function terminatingDigits($terminatingDigits) { + public function terminatingDigits(string $terminatingDigits) { $this->terminatingDigits = $terminatingDigits; } @@ -74,7 +144,7 @@ public function terminatingDigits($terminatingDigits) { * * @param int $maxDigits The maximum number of digits to collect in the gather */ - public function maxDigits($maxDigits) { + public function maxDigits(int $maxDigits) { $this->maxDigits = $maxDigits; } @@ -83,7 +153,7 @@ public function maxDigits($maxDigits) { * * @param int $interDigitTimeout The time in secods between digit presses before timing out */ - public function interDigitTimeout($interDigitTimeout) { + public function interDigitTimeout(int $interDigitTimeout) { $this->interDigitTimeout = $interDigitTimeout; } @@ -92,7 +162,7 @@ public function interDigitTimeout($interDigitTimeout) { * * @param int $firstDigitTimeout The time in seconds before the first digit is pressed before timing out */ - public function firstDigitTimeout($firstDigitTimeout) { + public function firstDigitTimeout(int $firstDigitTimeout) { $this->firstDigitTimeout = $firstDigitTimeout; } @@ -101,7 +171,7 @@ public function firstDigitTimeout($firstDigitTimeout) { * * @param PlayAudio $playAudio The PlayAudio tag to include in the Gather */ - public function playAudio($playAudio) { + public function playAudio(PlayAudio $playAudio) { $this->playAudio = $playAudio; $this->addNestableVerb($playAudio); } @@ -111,7 +181,7 @@ public function playAudio($playAudio) { * * @param int $repeatCount The number of times to repeat the played audio */ - public function repeatCount($repeatCount) { + public function repeatCount(int $repeatCount) { $this->repeatCount = $repeatCount; } @@ -120,7 +190,7 @@ public function repeatCount($repeatCount) { * * @param SpeakSentence $speakSentence The SpeakSentence tag to include in the Gather */ - public function speakSentence($speakSentence) { + public function speakSentence(SpeakSentence $speakSentence) { $this->speakSentence = $speakSentence; $this->addNestableVerb($speakSentence); } @@ -130,7 +200,7 @@ public function speakSentence($speakSentence) { * * @param string $gatherFallbackUrl Fallback url for gather events */ - public function gatherFallbackUrl($gatherFallbackUrl) { + public function gatherFallbackUrl(string $gatherFallbackUrl) { $this->gatherFallbackUrl = $gatherFallbackUrl; } @@ -139,7 +209,7 @@ public function gatherFallbackUrl($gatherFallbackUrl) { * * @param string $gatherFallbackMethod HTTP method for fallback events */ - public function gatherFallbackMethod($gatherFallbackMethod) { + public function gatherFallbackMethod(string $gatherFallbackMethod) { $this->gatherFallbackMethod = $gatherFallbackMethod; } @@ -148,7 +218,7 @@ public function gatherFallbackMethod($gatherFallbackMethod) { * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -157,7 +227,7 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } @@ -173,7 +243,7 @@ private function addNestableVerb($verb) { array_push($this->nestableVerbs, $verb); } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Gather"); if(isset($this->username)) { diff --git a/src/Voice/Bxml/Hangup.php b/src/Voice/Bxml/Hangup.php index e0afd61..1b9edcd 100644 --- a/src/Voice/Bxml/Hangup.php +++ b/src/Voice/Bxml/Hangup.php @@ -9,11 +9,13 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Hangup extends Verb { - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Hangup"); return $element; } diff --git a/src/Voice/Bxml/Pause.php b/src/Voice/Bxml/Pause.php index 865291b..a9a5442 100644 --- a/src/Voice/Bxml/Pause.php +++ b/src/Voice/Bxml/Pause.php @@ -9,20 +9,26 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Pause extends Verb { + /** + * @var float + */ + private $duration; /** * Sets the duration attribute for Pause * * @param float $duration The duration in seconds for the pause */ - public function duration($duration) { + public function duration(float $duration) { $this->duration = $duration; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Pause"); if(isset($this->duration)) { diff --git a/src/Voice/Bxml/PauseRecording.php b/src/Voice/Bxml/PauseRecording.php index 4d17ad1..0023b11 100644 --- a/src/Voice/Bxml/PauseRecording.php +++ b/src/Voice/Bxml/PauseRecording.php @@ -9,11 +9,13 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class PauseRecording extends Verb { - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("PauseRecording"); return $element; } diff --git a/src/Voice/Bxml/PhoneNumber.php b/src/Voice/Bxml/PhoneNumber.php index e41a902..869f0a2 100644 --- a/src/Voice/Bxml/PhoneNumber.php +++ b/src/Voice/Bxml/PhoneNumber.php @@ -9,16 +9,66 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class PhoneNumber extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $transferAnswerFallbackMethod; + /** + * @var string + */ + private $transferAnswerFallbackUrl; + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $transferDisconnectMethod; + /** + * @var string + */ + private $transferDisconnectUrl; + /** + * @var string + */ + private $transferAnswerMethod; + /** + * @var string + */ + private $transferAnswerUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $phoneNumber; /** * Constructor for PhoneNumber * * @param string $phoneNumber The phone number for the tag */ - public function __construct($phoneNumber) { + public function __construct(string $phoneNumber) { $this->phoneNumber = $phoneNumber; } @@ -27,7 +77,7 @@ public function __construct($phoneNumber) { * * @param string $username The username for http authentication on the audio url */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -36,7 +86,7 @@ public function username($username) { * * @param string $password The password for http authentication on the audio url */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -45,7 +95,7 @@ public function password($password) { * * @param string $transferAnswerUrl The url to receive the transfer answered callback */ - public function transferAnswerUrl($transferAnswerUrl) { + public function transferAnswerUrl(string $transferAnswerUrl) { $this->transferAnswerUrl = $transferAnswerUrl; } @@ -54,7 +104,7 @@ public function transferAnswerUrl($transferAnswerUrl) { * * @param string $transferAnswerMethod The http method to send the transfer answered callback */ - public function transferAnswerMethod($transferAnswerMethod) { + public function transferAnswerMethod(string $transferAnswerMethod) { $this->transferAnswerMethod = $transferAnswerMethod; } @@ -63,7 +113,7 @@ public function transferAnswerMethod($transferAnswerMethod) { * * @param string $transferDisconnectUrl The url to receive the transfer disconnect callback */ - public function transferDisconnectUrl($transferDisconnectUrl) { + public function transferDisconnectUrl(string $transferDisconnectUrl) { $this->transferDisconnectUrl = $transferDisconnectUrl; } @@ -72,7 +122,7 @@ public function transferDisconnectUrl($transferDisconnectUrl) { * * @param string $transferDisconnectMethod The http method to send the transfer disconnect callback */ - public function transferDisconnectMethod($transferDisconnectMethod) { + public function transferDisconnectMethod(string $transferDisconnectMethod) { $this->transferDisconnectMethod = $transferDisconnectMethod; } @@ -81,7 +131,7 @@ public function transferDisconnectMethod($transferDisconnectMethod) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -90,7 +140,7 @@ public function tag($tag) { * * @param string $transferAnswerFallbackUrl Fallback URL for transfer answer events */ - public function transferAnswerFallbackUrl($transferAnswerFallbackUrl) { + public function transferAnswerFallbackUrl(string $transferAnswerFallbackUrl) { $this->transferAnswerFallbackUrl = $transferAnswerFallbackUrl; } @@ -99,7 +149,7 @@ public function transferAnswerFallbackUrl($transferAnswerFallbackUrl) { * * @param string $transferAnswerFallbackMethod HTTP method for fallback events */ - public function transferAnswerFallbackMethod($transferAnswerFallbackMethod) { + public function transferAnswerFallbackMethod(string $transferAnswerFallbackMethod) { $this->transferAnswerFallbackMethod = $transferAnswerFallbackMethod; } @@ -108,7 +158,7 @@ public function transferAnswerFallbackMethod($transferAnswerFallbackMethod) { * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -117,11 +167,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("PhoneNumber"); $element->appendChild($doc->createTextNode($this->phoneNumber)); diff --git a/src/Voice/Bxml/PlayAudio.php b/src/Voice/Bxml/PlayAudio.php index a642516..5409f4b 100644 --- a/src/Voice/Bxml/PlayAudio.php +++ b/src/Voice/Bxml/PlayAudio.php @@ -9,16 +9,30 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class PlayAudio extends Verb { + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $url; /** * Constructor for PlayAudio * * @param string $url The URL of the audio to be played */ - public function __construct($url) { + public function __construct(string $url) { $this->url = $url; } @@ -27,7 +41,7 @@ public function __construct($url) { * * @param string $username The username for http authentication on the audio url */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -36,11 +50,11 @@ public function username($username) { * * @param string $password The password for http authentication on the audio url */ - public function password($password) { + public function password(string $password) { $this->password = $password; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("PlayAudio"); $element->appendChild($doc->createTextNode($this->url)); diff --git a/src/Voice/Bxml/Record.php b/src/Voice/Bxml/Record.php index 3ce965a..57e83a8 100644 --- a/src/Voice/Bxml/Record.php +++ b/src/Voice/Bxml/Record.php @@ -9,16 +9,90 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Record extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $recordCompleteFallbackMethod; + /** + * @var string + */ + private $recordCompleteFallbackUrl; + /** + * @var int + */ + private $silenceTimeout; + /** + * @var string + */ + private $transcriptionAvailableMethod; + /** + * @var string + */ + private $transcriptionAvailableUrl; + /** + * @var bool + */ + private $transcribe; + /** + * @var string + */ + private $fileFormat; + /** + * @var int + */ + private $maxDuration; + /** + * @var string + */ + private $terminatingDigits; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $recordingAvailableMethod; + /** + * @var string + */ + private $recordingAvailableUrl; + /** + * @var string + */ + private $recordCompleteMethod; + /** + * @var string + */ + private $recordCompleteUrl; + /** + * @var string + */ + private $tag; /** * Sets the tag attribute for Record * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -27,7 +101,7 @@ public function tag($tag) { * * @param string $recordCompleteUrl URL to send the record complete callback to */ - public function recordCompleteUrl($recordCompleteUrl) { + public function recordCompleteUrl(string $recordCompleteUrl) { $this->recordCompleteUrl = $recordCompleteUrl; } @@ -37,7 +111,7 @@ public function recordCompleteUrl($recordCompleteUrl) { * @param string $recordCompleteMethod HTTP method to send record complete * as ("GET" or "POST") */ - public function recordCompleteMethod($recordCompleteMethod) { + public function recordCompleteMethod(string $recordCompleteMethod) { $this->recordCompleteMethod = $recordCompleteMethod; } @@ -46,7 +120,7 @@ public function recordCompleteMethod($recordCompleteMethod) { * * @param string $recordingAvailableUrl URL to send the record available callback to */ - public function recordingAvailableUrl($recordingAvailableUrl) { + public function recordingAvailableUrl(string $recordingAvailableUrl) { $this->recordingAvailableUrl = $recordingAvailableUrl; } @@ -56,7 +130,7 @@ public function recordingAvailableUrl($recordingAvailableUrl) { * @param string $recordingAvailableMethod HTTP method to send record available * as ("GET" or "POST") */ - public function recordingAvailableMethod($recordingAvailableMethod) { + public function recordingAvailableMethod(string $recordingAvailableMethod) { $this->recordingAvailableMethod = $recordingAvailableMethod; } @@ -65,7 +139,7 @@ public function recordingAvailableMethod($recordingAvailableMethod) { * * @param string $username Username for basic auth for callbacks */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -74,7 +148,7 @@ public function username($username) { * * @param string $password Password for basic auth for callbacks */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -83,7 +157,7 @@ public function password($password) { * * @param string $terminatingDigits Digits to terminate the recording */ - public function terminatingDigits($terminatingDigits) { + public function terminatingDigits(string $terminatingDigits) { $this->terminatingDigits = $terminatingDigits; } @@ -92,7 +166,7 @@ public function terminatingDigits($terminatingDigits) { * * @param int $maxDuration Maximum length of the recording in secods */ - public function maxDuration($maxDuration) { + public function maxDuration(int $maxDuration) { $this->maxDuration = $maxDuration; } @@ -101,7 +175,7 @@ public function maxDuration($maxDuration) { * * @param string $fileFormat Audio format of the recording ("mp3" or "wav") */ - public function fileFormat($fileFormat) { + public function fileFormat(string $fileFormat) { $this->fileFormat = $fileFormat; } @@ -119,7 +193,7 @@ public function detectLanguage($detectLanguage) { * * @param boolean $transcribe True to submit the recording for transcription, false otherwise */ - public function transcribe($transcribe) { + public function transcribe(bool $transcribe) { $this->transcribe = $transcribe; } @@ -128,7 +202,7 @@ public function transcribe($transcribe) { * * @param string $transcriptionAvailableUrl URL to send transcription available events to */ - public function transcriptionAvailableUrl($transcriptionAvailableUrl) { + public function transcriptionAvailableUrl(string $transcriptionAvailableUrl) { $this->transcriptionAvailableUrl = $transcriptionAvailableUrl; } @@ -137,7 +211,7 @@ public function transcriptionAvailableUrl($transcriptionAvailableUrl) { * * @param string $transcriptionAvailableMethod HTTP method (GET or POST) to send the transcription available event as */ - public function transcriptionAvailableMethod($transcriptionAvailableMethod) { + public function transcriptionAvailableMethod(string $transcriptionAvailableMethod) { $this->transcriptionAvailableMethod = $transcriptionAvailableMethod; } @@ -146,7 +220,7 @@ public function transcriptionAvailableMethod($transcriptionAvailableMethod) { * * @param int $silenceTimeout Number of seconds of silence that ends the recording */ - public function silenceTimeout($silenceTimeout) { + public function silenceTimeout(int $silenceTimeout) { $this->silenceTimeout = $silenceTimeout; } @@ -155,7 +229,7 @@ public function silenceTimeout($silenceTimeout) { * * @param string $recordCompleteFallbackUrl Fallback URL for record complete events */ - public function recordCompleteFallbackUrl($recordCompleteFallbackUrl) { + public function recordCompleteFallbackUrl(string $recordCompleteFallbackUrl) { $this->recordCompleteFallbackUrl = $recordCompleteFallbackUrl; } @@ -164,7 +238,7 @@ public function recordCompleteFallbackUrl($recordCompleteFallbackUrl) { * * @param string $recordCompleteFallbackMethod HTTP method for fallback events */ - public function recordCompleteFallbackMethod($recordCompleteFallbackMethod) { + public function recordCompleteFallbackMethod(string $recordCompleteFallbackMethod) { $this->recordCompleteFallbackMethod = $recordCompleteFallbackMethod; } @@ -173,7 +247,7 @@ public function recordCompleteFallbackMethod($recordCompleteFallbackMethod) { * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -182,11 +256,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Record"); if(isset($this->tag)) { diff --git a/src/Voice/Bxml/Redirect.php b/src/Voice/Bxml/Redirect.php index 95dc16e..8968831 100644 --- a/src/Voice/Bxml/Redirect.php +++ b/src/Voice/Bxml/Redirect.php @@ -9,16 +9,54 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Redirect extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $redirectFallbackMethod; + /** + * @var string + */ + private $redirectFallbackUrl; + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $redirectMethod; + /** + * @var string + */ + private $redirectUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; /** * Sets the username attribute for Redirect * * @param string $username The username for http authentication on the redirect callback url */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -27,7 +65,7 @@ public function username($username) { * * @param string $password The password for http authentication on the redirect callback url */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -36,7 +74,7 @@ public function password($password) { * * @param string $redirectUrl The url to receive the redirect callback */ - public function redirectUrl($redirectUrl) { + public function redirectUrl(string $redirectUrl) { $this->redirectUrl = $redirectUrl; } @@ -45,7 +83,7 @@ public function redirectUrl($redirectUrl) { * * @param string $redirectMethod The http method to send the redirect callback */ - public function redirectMethod($redirectMethod) { + public function redirectMethod(string $redirectMethod) { $this->redirectMethod = $redirectMethod; } @@ -54,7 +92,7 @@ public function redirectMethod($redirectMethod) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -63,7 +101,7 @@ public function tag($tag) { * * @param string $redirectFallbackUrl Fallback url for redirect events */ - public function redirectFallbackUrl($redirectFallbackUrl) { + public function redirectFallbackUrl(string $redirectFallbackUrl) { $this->redirectFallbackUrl = $redirectFallbackUrl; } @@ -72,7 +110,7 @@ public function redirectFallbackUrl($redirectFallbackUrl) { * * @param string $redirectFallbackMethod HTTP method for fallback events */ - public function redirectFallbackMethod($redirectFallbackMethod) { + public function redirectFallbackMethod(string $redirectFallbackMethod) { $this->redirectFallbackMethod = $redirectFallbackMethod; } @@ -81,7 +119,7 @@ public function redirectFallbackMethod($redirectFallbackMethod) { * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -90,11 +128,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Redirect"); if(isset($this->username)) { diff --git a/src/Voice/Bxml/Response.php b/src/Voice/Bxml/Response.php index ed24d75..3734809 100644 --- a/src/Voice/Bxml/Response.php +++ b/src/Voice/Bxml/Response.php @@ -12,6 +12,10 @@ use DOMDocument; class Response { + /** + * @var array + */ + private $verbs; /** * Creates the Response class with an emty list of verbs @@ -25,7 +29,7 @@ public function __construct() { * * @param Verb $verb The verb to add to the list */ - public function addVerb($verb) { + public function addVerb(Verb $verb) { array_push($this->verbs, $verb); } diff --git a/src/Voice/Bxml/ResumeRecording.php b/src/Voice/Bxml/ResumeRecording.php index 89400d2..f3537fd 100644 --- a/src/Voice/Bxml/ResumeRecording.php +++ b/src/Voice/Bxml/ResumeRecording.php @@ -9,11 +9,13 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class ResumeRecording extends Verb { - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("ResumeRecording"); return $element; } diff --git a/src/Voice/Bxml/Ring.php b/src/Voice/Bxml/Ring.php index 01bc62d..fd90307 100644 --- a/src/Voice/Bxml/Ring.php +++ b/src/Voice/Bxml/Ring.php @@ -9,16 +9,26 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Ring extends Verb { + /** + * @var bool + */ + private $answerCall; + /** + * @var float + */ + private $duration; /** * Sets the duration attribute for Ring * * @param float $duration The duration in seconds for the ring */ - public function duration($duration) { + public function duration(float $duration) { $this->duration = $duration; } @@ -27,11 +37,11 @@ public function duration($duration) { * * @param boolean $answerCall Determines whether or not to answer the call when Ring is executed on an unanswered incoming call */ - public function answerCall($answerCall) { + public function answerCall(bool $answerCall) { $this->answerCall = $answerCall; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Ring"); if(isset($this->duration)) { diff --git a/src/Voice/Bxml/SendDtmf.php b/src/Voice/Bxml/SendDtmf.php index 819fcee..4682a72 100644 --- a/src/Voice/Bxml/SendDtmf.php +++ b/src/Voice/Bxml/SendDtmf.php @@ -9,16 +9,30 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class SendDtmf extends Verb { + /** + * @var float + */ + private $toneInterval; + /** + * @var float + */ + private $toneDuration; + /** + * @var string + */ + private $digits; /** * Constructor for SendDtmf * * @param string $digits The dtmf digits */ - public function __construct($digits) { + public function __construct(string $digits) { $this->digits = $digits; } @@ -27,7 +41,7 @@ public function __construct($digits) { * * @param double $toneDuration The length in milliseconds of each DTMF tone */ - public function toneDuration($toneDuration) { + public function toneDuration(float $toneDuration) { $this->toneDuration = $toneDuration; } @@ -36,11 +50,11 @@ public function toneDuration($toneDuration) { * * @param double $toneInterval The duration of silence in milliseconds following each DTMF tone */ - public function toneInterval($toneInterval) { + public function toneInterval(float $toneInterval) { $this->toneInterval = $toneInterval; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("SendDtmf"); $element->appendChild($doc->createTextNode($this->digits)); diff --git a/src/Voice/Bxml/SipUri.php b/src/Voice/Bxml/SipUri.php index f3f9f3b..6e019de 100644 --- a/src/Voice/Bxml/SipUri.php +++ b/src/Voice/Bxml/SipUri.php @@ -9,16 +9,70 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class SipUri extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $transferAnswerFallbackMethod; + /** + * @var string + */ + private $transferAnswerFallbackUrl; + /** + * @var string + */ + private $uui; + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $transferDisconnectMethod; + /** + * @var string + */ + private $transferDisconnectUrl; + /** + * @var string + */ + private $transferAnswerMethod; + /** + * @var string + */ + private $transferAnswerUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $sip; /** * Constructor for SipUri * * @param string $sip The sip uri destination */ - public function __construct($sip) { + public function __construct(string $sip) { $this->sip = $sip; } @@ -27,7 +81,7 @@ public function __construct($sip) { * * @param string $username The username for http authentication on the audio url */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -36,7 +90,7 @@ public function username($username) { * * @param string $password The password for http authentication on the audio url */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -45,7 +99,7 @@ public function password($password) { * * @param string $transferAnswerUrl The url to receive the transfer answered callback */ - public function transferAnswerUrl($transferAnswerUrl) { + public function transferAnswerUrl(string $transferAnswerUrl) { $this->transferAnswerUrl = $transferAnswerUrl; } @@ -54,7 +108,7 @@ public function transferAnswerUrl($transferAnswerUrl) { * * @param string $transferAnswerMethod The http method to send the transfer answered callback */ - public function transferAnswerMethod($transferAnswerMethod) { + public function transferAnswerMethod(string $transferAnswerMethod) { $this->transferAnswerMethod = $transferAnswerMethod; } @@ -63,7 +117,7 @@ public function transferAnswerMethod($transferAnswerMethod) { * * @param string $transferDisconnectUrl The url to receive the transfer disconnect callback */ - public function transferDisconnectUrl($transferDisconnectUrl) { + public function transferDisconnectUrl(string $transferDisconnectUrl) { $this->transferDisconnectUrl = $transferDisconnectUrl; } @@ -72,7 +126,7 @@ public function transferDisconnectUrl($transferDisconnectUrl) { * * @param string $transferDisconnectMethod The http method to send the transfer disconnect callback */ - public function transferDisconnectMethod($transferDisconnectMethod) { + public function transferDisconnectMethod(string $transferDisconnectMethod) { $this->transferDisconnectMethod = $transferDisconnectMethod; } @@ -81,7 +135,7 @@ public function transferDisconnectMethod($transferDisconnectMethod) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -90,7 +144,7 @@ public function tag($tag) { * * @param string $uui The value of the `User-To-User` header to send within the initial `INVITE` */ - public function uui($uui) { + public function uui(string $uui) { $this->uui = $uui; } @@ -99,7 +153,7 @@ public function uui($uui) { * * @param string $transferAnswerFallbackUrl Fallback URL for transfer answer events */ - public function transferAnswerFallbackUrl($transferAnswerFallbackUrl) { + public function transferAnswerFallbackUrl(string $transferAnswerFallbackUrl) { $this->transferAnswerFallbackUrl = $transferAnswerFallbackUrl; } @@ -108,7 +162,7 @@ public function transferAnswerFallbackUrl($transferAnswerFallbackUrl) { * * @param string $transferAnswerFallbackMethod HTTP method for fallback events */ - public function transferAnswerFallbackMethod($transferAnswerFallbackMethod) { + public function transferAnswerFallbackMethod(string $transferAnswerFallbackMethod) { $this->transferAnswerFallbackMethod = $transferAnswerFallbackMethod; } @@ -117,7 +171,7 @@ public function transferAnswerFallbackMethod($transferAnswerFallbackMethod) { * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -126,11 +180,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("SipUri"); $element->appendChild($doc->createTextNode($this->sip)); diff --git a/src/Voice/Bxml/SpeakSentence.php b/src/Voice/Bxml/SpeakSentence.php index 68e3dcb..7e25e62 100644 --- a/src/Voice/Bxml/SpeakSentence.php +++ b/src/Voice/Bxml/SpeakSentence.php @@ -9,16 +9,34 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class SpeakSentence extends Verb { + /** + * @var string + */ + private $gender; + /** + * @var string + */ + private $locale; + /** + * @var string + */ + private $voice; + /** + * @var string + */ + private $sentence; /** * Constructor for SpeakSentence * * @param string $sentence The sentence to speak in the call */ - public function __construct($sentence) { + public function __construct(string $sentence) { $this->sentence = $sentence; } @@ -27,7 +45,7 @@ public function __construct($sentence) { * * @param string $voice The voice to speak in the call */ - public function voice($voice) { + public function voice(string $voice) { $this->voice = $voice; } @@ -36,7 +54,7 @@ public function voice($voice) { * * @param string $locale The locale of the voice in the call */ - public function locale($locale) { + public function locale(string $locale) { $this->locale = $locale; } @@ -45,11 +63,11 @@ public function locale($locale) { * * @param string $gender The gender of the voice in the call */ - public function gender($gender) { + public function gender(string $gender) { $this->gender = $gender; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("SpeakSentence"); $element->appendChild($doc->createTextNode($this->sentence)); diff --git a/src/Voice/Bxml/StartGather.php b/src/Voice/Bxml/StartGather.php index 5778346..cf9469b 100644 --- a/src/Voice/Bxml/StartGather.php +++ b/src/Voice/Bxml/StartGather.php @@ -9,18 +9,40 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; require_once "SpeakSentence.php"; require_once "PlayAudio.php"; class StartGather extends Verb { + /** + * @var string + */ + private $tag; + /** + * @var string + */ + private $dtmfMethod; + /** + * @var string + */ + private $dtmfUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; /** * Sets the username attribute for StartGather * * @param string $username The username for http authentication for the gather callback */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -29,7 +51,7 @@ public function username($username) { * * @param string $password The password for http authentication for the gather callback */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -38,7 +60,7 @@ public function password($password) { * * @param string $dtmfUrl The url to receive the dtmf callback */ - public function dtmfUrl($dtmfUrl) { + public function dtmfUrl(string $dtmfUrl) { $this->dtmfUrl = $dtmfUrl; } @@ -47,7 +69,7 @@ public function dtmfUrl($dtmfUrl) { * * @param string $dtmfMethod The http method to send the dtmf callback */ - public function dtmfMethod($dtmfMethod) { + public function dtmfMethod(string $dtmfMethod) { $this->dtmfMethod = $dtmfMethod; } @@ -56,11 +78,11 @@ public function dtmfMethod($dtmfMethod) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StartGather"); if(isset($this->username)) { diff --git a/src/Voice/Bxml/StartRecording.php b/src/Voice/Bxml/StartRecording.php index 76c176e..2803cb0 100644 --- a/src/Voice/Bxml/StartRecording.php +++ b/src/Voice/Bxml/StartRecording.php @@ -9,16 +9,58 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class StartRecording extends Verb { + /** + * @var string + */ + private $transcriptionAvailableMethod; + /** + * @var string + */ + private $transcriptionAvailableUrl; + /** + * @var bool + */ + private $transcribe; + /** + * @var bool + */ + private $multiChannel; + /** + * @var string + */ + private $fileFormat; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $recordingAvailableMethod; + /** + * @var string + */ + private $recordingAvailableUrl; + /** + * @var string + */ + private $tag; /** * Sets the tag attribute for StartRecording * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -27,7 +69,7 @@ public function tag($tag) { * * @param string $recordingAvailableUrl URL to send the record available callback to */ - public function recordingAvailableUrl($recordingAvailableUrl) { + public function recordingAvailableUrl(string $recordingAvailableUrl) { $this->recordingAvailableUrl = $recordingAvailableUrl; } @@ -37,7 +79,7 @@ public function recordingAvailableUrl($recordingAvailableUrl) { * @param string $recordingAvailableMethod HTTP method to send record available * as ("GET" or "POST") */ - public function recordingAvailableMethod($recordingAvailableMethod) { + public function recordingAvailableMethod(string $recordingAvailableMethod) { $this->recordingAvailableMethod = $recordingAvailableMethod; } @@ -46,7 +88,7 @@ public function recordingAvailableMethod($recordingAvailableMethod) { * * @param string $username Username for basic auth for callbacks */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -55,7 +97,7 @@ public function username($username) { * * @param string $password Password for basic auth for callbacks */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -64,7 +106,7 @@ public function password($password) { * * @param string $fileFormat Audio format of the recording ("mp3" or "wav") */ - public function fileFormat($fileFormat) { + public function fileFormat(string $fileFormat) { $this->fileFormat = $fileFormat; } @@ -83,7 +125,7 @@ public function detectLanguage($detectLanguage) { * * @param bool $multiChannel True to record the audio as 2 channels, false otherwise */ - public function multiChannel($multiChannel) { + public function multiChannel(bool $multiChannel) { $this->multiChannel = $multiChannel; } @@ -92,7 +134,7 @@ public function multiChannel($multiChannel) { * * @param boolean $transcribe True to submit the recording for transcription, false otherwise */ - public function transcribe($transcribe) { + public function transcribe(bool $transcribe) { $this->transcribe = $transcribe; } @@ -101,7 +143,7 @@ public function transcribe($transcribe) { * * @param string $transcriptionAvailableUrl URL to send transcription available events to */ - public function transcriptionAvailableUrl($transcriptionAvailableUrl) { + public function transcriptionAvailableUrl(string $transcriptionAvailableUrl) { $this->transcriptionAvailableUrl = $transcriptionAvailableUrl; } @@ -110,11 +152,11 @@ public function transcriptionAvailableUrl($transcriptionAvailableUrl) { * * @param string $transcriptionAvailableMethod HTTP method (GET or POST) to send the transcription available event as */ - public function transcriptionAvailableMethod($transcriptionAvailableMethod) { + public function transcriptionAvailableMethod(string $transcriptionAvailableMethod) { $this->transcriptionAvailableMethod = $transcriptionAvailableMethod; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StartRecording"); if(isset($this->tag)) { diff --git a/src/Voice/Bxml/StartStream.php b/src/Voice/Bxml/StartStream.php index d7e1ef4..3134a11 100644 --- a/src/Voice/Bxml/StartStream.php +++ b/src/Voice/Bxml/StartStream.php @@ -9,16 +9,47 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class StartStream extends Verb { + private $streamParams; + /** + * @var bool + */ + private $streamEventMethod; + /** + * @var string + */ + private $streamEventUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; + /** + * @var string + */ + private $tracks; + /** + * @var string + */ + private $name; + /** + * @var string + */ + private $destination; /** * Sets the destination attribute for StartStream * * @param string $destination A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL encoded as base64 encoded PCMU/G711 audio. See below for more details on the websocket packet format. */ - public function destination($destination) { + public function destination(string $destination) { $this->destination = $destination; } @@ -27,7 +58,7 @@ public function destination($destination) { * * @param string $name A name to refer to this stream by. Used when sending [``][1]. If not provided, a random name will be generated and sent in the [`Media Stream Started`][2] webook */ - public function name($name) { + public function name(string $name) { $this->name = $name; } @@ -37,7 +68,7 @@ public function name($name) { * @param string $tracks The part of the call to send a stream from. `inbound`, `outbound` or `both`. Default is `inbound`. * */ - public function tracks($tracks) { + public function tracks(string $tracks) { $this->tracks = $tracks; } @@ -46,7 +77,7 @@ public function tracks($tracks) { * * @param string $username The username to send in the HTTP request to `streamEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -55,7 +86,7 @@ public function username($username) { * * @param string $password The password to send in the HTTP request to `streamEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -64,7 +95,7 @@ public function password($password) { * * @param string $streamEventUrl URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. */ - public function streamEventUrl($streamEventUrl) { + public function streamEventUrl(string $streamEventUrl) { $this->streamEventUrl = $streamEventUrl; } @@ -73,7 +104,7 @@ public function streamEventUrl($streamEventUrl) { * * @param bool $streamEventMethod The HTTP method to use for the request to `streamEventUrl`. GET or POST. Default value is POST. */ - public function streamEventMethod($streamEventMethod) { + public function streamEventMethod(string $streamEventMethod) { $this->streamEventMethod = $streamEventMethod; } @@ -86,7 +117,7 @@ public function streamParams($streamParams) { $this->streamParams = $streamParams; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StartStream"); if(isset($this->destination)) { diff --git a/src/Voice/Bxml/StopGather.php b/src/Voice/Bxml/StopGather.php index 4de839f..3db8e82 100644 --- a/src/Voice/Bxml/StopGather.php +++ b/src/Voice/Bxml/StopGather.php @@ -9,11 +9,13 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class StopGather extends Verb { - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StopGather"); return $element; } diff --git a/src/Voice/Bxml/StopRecording.php b/src/Voice/Bxml/StopRecording.php index ac70663..f083112 100644 --- a/src/Voice/Bxml/StopRecording.php +++ b/src/Voice/Bxml/StopRecording.php @@ -9,11 +9,13 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class StopRecording extends Verb { - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StopRecording"); return $element; } diff --git a/src/Voice/Bxml/StopStream.php b/src/Voice/Bxml/StopStream.php index c6f1466..8f87240 100644 --- a/src/Voice/Bxml/StopStream.php +++ b/src/Voice/Bxml/StopStream.php @@ -9,20 +9,26 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class StopStream extends Verb { + /** + * @var string + */ + private $name; /** * Sets the name attribute for StopStream * - * @param float $name (required) The name of the stream to stop. This is either the user selected name when sending the [``][1] verb, or the system generated name returned in the [Media Stream Started][2] webhook if `` was sent with no `name` attribute. + * @param string $name (required) The name of the stream to stop. This is either the user selected name when sending the [``][1] verb, or the system generated name returned in the [Media Stream Started][2] webhook if `` was sent with no `name` attribute. */ - public function name($name) { + public function name(string $name) { $this->name = $name; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StopStream"); if(isset($this->name)) { diff --git a/src/Voice/Bxml/StreamParam.php b/src/Voice/Bxml/StreamParam.php index cafff17..6775829 100644 --- a/src/Voice/Bxml/StreamParam.php +++ b/src/Voice/Bxml/StreamParam.php @@ -9,16 +9,26 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class StreamParam extends Verb { + /** + * @var string + */ + private $value; + /** + * @var string + */ + private $name; /** * Sets the name attribute for StreamParam * * @param string $name (required) The name of this parameter, up to 256 characters. */ - public function name($name) { + public function name(string $name) { $this->name = $name; } @@ -27,11 +37,11 @@ public function name($name) { * * @param string $value (required) The value of this parameter, up to 2048 characters. */ - public function value($value) { + public function value(string $value) { $this->value = $value; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("StreamParam"); if(isset($this->name)) { diff --git a/src/Voice/Bxml/Tag.php b/src/Voice/Bxml/Tag.php index f72e4d7..45cf5ae 100644 --- a/src/Voice/Bxml/Tag.php +++ b/src/Voice/Bxml/Tag.php @@ -9,20 +9,26 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Tag extends Verb { + /** + * @var string + */ + private $tag; /** * Constructor for Tag * * @param string $tag The value to set the call tag to */ - public function __construct($tag) { + public function __construct(string $tag) { $this->tag = $tag; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Tag"); $element->appendChild($doc->createTextNode($this->tag)); diff --git a/src/Voice/Bxml/Transfer.php b/src/Voice/Bxml/Transfer.php index 7e88621..f18a790 100644 --- a/src/Voice/Bxml/Transfer.php +++ b/src/Voice/Bxml/Transfer.php @@ -9,16 +9,72 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + require_once "Verb.php"; class Transfer extends Verb { + /** + * @var string + */ + private $fallbackPassword; + /** + * @var string + */ + private $fallbackUsername; + /** + * @var string + */ + private $transferCompleteFallbackMethod; + /** + * @var string + */ + private $transferCompleteFallbackUrl; + private $sipUris; + private $phoneNumbers; + /** + * @var string + */ + private $diversionReason; + /** + * @var string + */ + private $diversionTreatment; + /** + * @var string + */ + private $tag; + /** + * @var int + */ + private $callTimeout; + /** + * @var string + */ + private $transferCallerId; + /** + * @var string + */ + private $transferCompleteMethod; + /** + * @var string + */ + private $transferCompleteUrl; + /** + * @var string + */ + private $password; + /** + * @var string + */ + private $username; /** * Sets the username attribute for Transfer * * @param string $username The username for http authentication on the transfer answered callback url */ - public function username($username) { + public function username(string $username) { $this->username = $username; } @@ -27,7 +83,7 @@ public function username($username) { * * @param string $password The password for http authentication on the transfer answered callback url */ - public function password($password) { + public function password(string $password) { $this->password = $password; } @@ -36,7 +92,7 @@ public function password($password) { * * @param string $transferCompleteUrl The url to receive the transfer answered callback */ - public function transferCompleteUrl($transferCompleteUrl) { + public function transferCompleteUrl(string $transferCompleteUrl) { $this->transferCompleteUrl = $transferCompleteUrl; } @@ -45,7 +101,7 @@ public function transferCompleteUrl($transferCompleteUrl) { * * @param string $transferCompleteMethod The http method to send the transfer answered callback */ - public function transferCompleteMethod($transferCompleteMethod) { + public function transferCompleteMethod(string $transferCompleteMethod) { $this->transferCompleteMethod = $transferCompleteMethod; } @@ -54,7 +110,7 @@ public function transferCompleteMethod($transferCompleteMethod) { * * @param string $transferCallerId The caller id to use when the call is transferred */ - public function transferCallerId($transferCallerId) { + public function transferCallerId(string $transferCallerId) { $this->transferCallerId = $transferCallerId; } @@ -63,7 +119,7 @@ public function transferCallerId($transferCallerId) { * * @param int $callTimeout The number of seconds to wait before timing out the call */ - public function callTimeout($callTimeout) { + public function callTimeout(int $callTimeout) { $this->callTimeout = $callTimeout; } @@ -72,7 +128,7 @@ public function callTimeout($callTimeout) { * * @param string $tag A custom string to be included in callbacks */ - public function tag($tag) { + public function tag(string $tag) { $this->tag = $tag; } @@ -81,7 +137,7 @@ public function tag($tag) { * * @param string $diversionTreatment The diversion treatment for the phone call */ - public function diversionTreatment($diversionTreatment) { + public function diversionTreatment(string $diversionTreatment) { $this->diversionTreatment = $diversionTreatment; } @@ -90,7 +146,7 @@ public function diversionTreatment($diversionTreatment) { * * @param string $diversionReason The diversion treatment for the phone call */ - public function diversionReason($diversionReason) { + public function diversionReason(string $diversionReason) { $this->diversionReason = $diversionReason; } @@ -117,7 +173,7 @@ public function sipUris($sipUris) { * * @param string $transferCompleteFallbackUrl Fallback url for transfer complete events */ - public function transferCompleteFallbackUrl($transferCompleteFallbackUrl) { + public function transferCompleteFallbackUrl(string $transferCompleteFallbackUrl) { $this->transferCompleteFallbackUrl = $transferCompleteFallbackUrl; } @@ -126,7 +182,7 @@ public function transferCompleteFallbackUrl($transferCompleteFallbackUrl) { * * @param string $transferCompleteFallbackMethod HTTP method for fallback events */ - public function transferCompleteFallbackMethod($transferCompleteFallbackMethod) { + public function transferCompleteFallbackMethod(string $transferCompleteFallbackMethod) { $this->transferCompleteFallbackMethod = $transferCompleteFallbackMethod; } @@ -135,7 +191,7 @@ public function transferCompleteFallbackMethod($transferCompleteFallbackMethod) * * @param string $fallbackUsername HTTP basic auth username for fallback events */ - public function fallbackUsername($fallbackUsername) { + public function fallbackUsername(string $fallbackUsername) { $this->fallbackUsername = $fallbackUsername; } @@ -144,11 +200,11 @@ public function fallbackUsername($fallbackUsername) { * * @param string $fallbackPassword HTTP basic auth password for fallback events */ - public function fallbackPassword($fallbackPassword) { + public function fallbackPassword(string $fallbackPassword) { $this->fallbackPassword = $fallbackPassword; } - public function toBxml($doc) { + public function toBxml(DOMDocument $doc) { $element = $doc->createElement("Transfer"); if(isset($this->username)) { diff --git a/src/Voice/Bxml/Verb.php b/src/Voice/Bxml/Verb.php index 7f7cde0..0d6a084 100644 --- a/src/Voice/Bxml/Verb.php +++ b/src/Voice/Bxml/Verb.php @@ -9,14 +9,16 @@ namespace BandwidthLib\Voice\Bxml; +use DOMDocument; + abstract class Verb { /** * Converts the verb class into a DOMElement to build the complete BXML * - * @param DOMDocument $doc The document that is building the BXML - * @return DOMElement The element representing the verb +// * @param DOMDocument $doc The document that is building the BXML +// * @return DOMElement The element representing the verb */ - abstract protected function toBxml($doc); + abstract protected function toBxml(DOMDocument $doc); } diff --git a/src/Voice/Controllers/APIController.php b/src/Voice/Controllers/APIController.php index 1afcc39..692b005 100644 --- a/src/Voice/Controllers/APIController.php +++ b/src/Voice/Controllers/APIController.php @@ -33,14 +33,14 @@ public function __construct($config, $httpCallBack = null) /** * Creates an outbound phone call. * - * @param string $accountId TODO: type description here + * @param string $accountId TODO: type description here * @param Models\CreateCallRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createCall( - $accountId, - $body + string $accountId, + Models\CreateCallRequest $body ) { //prepare query string for API call @@ -150,8 +150,8 @@ public function createCall( * @throws APIException Thrown if API call fails */ public function getCall( - $accountId, - $callId + string $accountId, + string $callId ) { //prepare query string for API call @@ -252,16 +252,16 @@ public function getCall( /** * Replaces the bxml for an active call * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $body Valid BXML string + * @param string $accountId TODO: type description here + * @param string $callId TODO: type description here + * @param string $body Valid BXML string * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function modifyCallBxml( - $accountId, - $callId, - $body + string $accountId, + string $callId, + string $body ) { //prepare query string for API call @@ -360,16 +360,16 @@ public function modifyCallBxml( /** * Interrupts and replaces an active call's BXML document. * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here + * @param string $accountId TODO: type description here + * @param string $callId TODO: type description here * @param Models\ModifyCallRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function modifyCall( - $accountId, - $callId, - $body + string $accountId, + string $callId, + Models\ModifyCallRequest $body ) { //prepare query string for API call @@ -471,16 +471,16 @@ public function modifyCall( /** * Pauses or resumes a recording. * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here + * @param string $accountId TODO: type description here + * @param string $callId TODO: type description here * @param Models\ModifyCallRecordingRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function modifyCallRecordingState( - $accountId, - $callId, - $body + string $accountId, + string $callId, + Models\ModifyCallRecordingRequest $body ) { //prepare query string for API call @@ -589,8 +589,8 @@ public function modifyCallRecordingState( * @throws APIException Thrown if API call fails */ public function getCallRecordings( - $accountId, - $callId + string $accountId, + string $callId ) { //prepare query string for API call @@ -701,9 +701,9 @@ public function getCallRecordings( * @throws APIException Thrown if API call fails */ public function getCallRecording( - $accountId, - $callId, - $recordingId + string $accountId, + string $callId, + string $recordingId ) { //prepare query string for API call @@ -815,9 +815,9 @@ public function getCallRecording( * @throws APIException Thrown if API call fails */ public function deleteRecording( - $accountId, - $callId, - $recordingId + string $accountId, + string $callId, + string $recordingId ) { //prepare query string for API call @@ -923,9 +923,9 @@ public function deleteRecording( * @throws APIException Thrown if API call fails */ public function getDownloadCallRecording( - $accountId, - $callId, - $recordingId + string $accountId, + string $callId, + string $recordingId ) { //prepare query string for API call @@ -1034,9 +1034,9 @@ public function getDownloadCallRecording( * @throws APIException Thrown if API call fails */ public function deleteRecordingMedia( - $accountId, - $callId, - $recordingId + string $accountId, + string $callId, + string $recordingId ) { //prepare query string for API call @@ -1143,9 +1143,9 @@ public function deleteRecordingMedia( * @throws APIException Thrown if API call fails */ public function getCallTranscription( - $accountId, - $callId, - $recordingId + string $accountId, + string $callId, + string $recordingId ) { //prepare query string for API call @@ -1251,18 +1251,18 @@ public function getCallTranscription( /** * Requests that the specified recording be transcribed. * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here + * @param string $accountId TODO: type description here + * @param string $callId TODO: type description here + * @param string $recordingId TODO: type description here * @param Models\TranscribeRecordingRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createTranscribeCallRecording( - $accountId, - $callId, - $recordingId, - $body + string $accountId, + string $callId, + string $recordingId, + Models\TranscribeRecordingRequest $body ) { //prepare query string for API call @@ -1380,9 +1380,9 @@ public function createTranscribeCallRecording( * @throws APIException Thrown if API call fails */ public function deleteCallTranscription( - $accountId, - $callId, - $recordingId + string $accountId, + string $callId, + string $recordingId ) { //prepare query string for API call @@ -1482,22 +1482,22 @@ public function deleteCallTranscription( /** * Returns information about the conferences in the account. * - * @param string $accountId TODO: type description here - * @param string $name (optional) TODO: type description here - * @param string $minCreatedTime (optional) TODO: type description here - * @param string $maxCreatedTime (optional) TODO: type description here + * @param string $accountId TODO: type description here + * @param string|null $name (optional) TODO: type description here + * @param string|null $minCreatedTime (optional) TODO: type description here + * @param string|null $maxCreatedTime (optional) TODO: type description here * @param integer $pageSize (optional) Example: 1000 - * @param string $pageToken (optional) TODO: type description here + * @param string|null $pageToken (optional) TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function getConferences( - $accountId, - $name = null, - $minCreatedTime = null, - $maxCreatedTime = null, - $pageSize = 1000, - $pageToken = null + string $accountId, + string $name = null, + string $minCreatedTime = null, + string $maxCreatedTime = null, + int $pageSize = 1000, + string $pageToken = null ) { //prepare query string for API call @@ -1612,8 +1612,8 @@ public function getConferences( * @throws APIException Thrown if API call fails */ public function getConference( - $accountId, - $conferenceId + string $accountId, + string $conferenceId ) { //prepare query string for API call @@ -1714,16 +1714,16 @@ public function getConference( /** * Modify the conference state. * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here + * @param string $accountId TODO: type description here + * @param string $conferenceId TODO: type description here * @param Models\ModifyConferenceRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function modifyConference( - $accountId, - $conferenceId, - $body + string $accountId, + string $conferenceId, + Models\ModifyConferenceRequest $body ) { //prepare query string for API call @@ -1825,18 +1825,18 @@ public function modifyConference( /** * Updates settings for a particular conference member. * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param string $callId TODO: type description here + * @param string $accountId TODO: type description here + * @param string $conferenceId TODO: type description here + * @param string $callId TODO: type description here * @param Models\ConferenceMemberState $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function modifyConferenceMember( - $accountId, - $conferenceId, - $callId, - $body + string $accountId, + string $conferenceId, + string $callId, + Models\ConferenceMemberState $body ) { //prepare query string for API call @@ -1946,9 +1946,9 @@ public function modifyConferenceMember( * @throws APIException Thrown if API call fails */ public function getConferenceMember( - $accountId, - $conferenceId, - $memberId + string $accountId, + string $conferenceId, + string $memberId ) { //prepare query string for API call @@ -2061,8 +2061,8 @@ public function getConferenceMember( * @throws APIException Thrown if API call fails */ public function getConferenceRecordings( - $accountId, - $conferenceId + string $accountId, + string $conferenceId ) { //prepare query string for API call @@ -2173,9 +2173,9 @@ public function getConferenceRecordings( * @throws APIException Thrown if API call fails */ public function getConferenceRecording( - $accountId, - $conferenceId, - $recordingId + string $accountId, + string $conferenceId, + string $recordingId ) { //prepare query string for API call @@ -2288,9 +2288,9 @@ public function getConferenceRecording( * @throws APIException Thrown if API call fails */ public function getDownloadConferenceRecording( - $accountId, - $conferenceId, - $recordingId + string $accountId, + string $conferenceId, + string $recordingId ) { //prepare query string for API call @@ -2395,19 +2395,19 @@ public function getDownloadConferenceRecording( * 1000 entries and may be empty if no recordings match the specified criteria. * * @param string $accountId TODO: type description here - * @param string $from (optional) TODO: type description here - * @param string $to (optional) TODO: type description here - * @param string $minStartTime (optional) TODO: type description here - * @param string $maxStartTime (optional) TODO: type description here + * @param string|null $from (optional) TODO: type description here + * @param string|null $to (optional) TODO: type description here + * @param string|null $minStartTime (optional) TODO: type description here + * @param string|null $maxStartTime (optional) TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function getQueryCallRecordings( - $accountId, - $from = null, - $to = null, - $minStartTime = null, - $maxStartTime = null + string $accountId, + string $from = null, + string $to = null, + string $minStartTime = null, + string $maxStartTime = null ) { //prepare query string for API call diff --git a/src/Voice/Models/CallCallback.php b/src/Voice/Models/CallCallback.php index c21f2dd..4401a50 100644 --- a/src/Voice/Models/CallCallback.php +++ b/src/Voice/Models/CallCallback.php @@ -235,7 +235,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['eventType'] = $this->eventType; diff --git a/src/Voice/Models/CallRecordingMetadata.php b/src/Voice/Models/CallRecordingMetadata.php index 139e67b..cd65992 100644 --- a/src/Voice/Models/CallRecordingMetadata.php +++ b/src/Voice/Models/CallRecordingMetadata.php @@ -156,7 +156,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['applicationId'] = $this->applicationId; diff --git a/src/Voice/Models/CallState.php b/src/Voice/Models/CallState.php index 08e2e54..6a6540e 100644 --- a/src/Voice/Models/CallState.php +++ b/src/Voice/Models/CallState.php @@ -162,7 +162,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['callId'] = $this->callId; diff --git a/src/Voice/Models/ConferenceCallback.php b/src/Voice/Models/ConferenceCallback.php index 7fab464..840f012 100644 --- a/src/Voice/Models/ConferenceCallback.php +++ b/src/Voice/Models/ConferenceCallback.php @@ -144,7 +144,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['conferenceId'] = $this->conferenceId; diff --git a/src/Voice/Models/ConferenceMemberState.php b/src/Voice/Models/ConferenceMemberState.php index 406a769..9b25767 100644 --- a/src/Voice/Models/ConferenceMemberState.php +++ b/src/Voice/Models/ConferenceMemberState.php @@ -66,7 +66,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['callId'] = $this->callId; diff --git a/src/Voice/Models/ConferenceRecordingMetadata.php b/src/Voice/Models/ConferenceRecordingMetadata.php index db38412..7277ab5 100644 --- a/src/Voice/Models/ConferenceRecordingMetadata.php +++ b/src/Voice/Models/ConferenceRecordingMetadata.php @@ -107,7 +107,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['accountId'] = $this->accountId; diff --git a/src/Voice/Models/ConferenceState.php b/src/Voice/Models/ConferenceState.php index d204467..8ef6499 100644 --- a/src/Voice/Models/ConferenceState.php +++ b/src/Voice/Models/ConferenceState.php @@ -84,7 +84,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['id'] = $this->id; diff --git a/src/Voice/Models/CreateCallRequest.php b/src/Voice/Models/CreateCallRequest.php index c58f660..2474794 100644 --- a/src/Voice/Models/CreateCallRequest.php +++ b/src/Voice/Models/CreateCallRequest.php @@ -164,7 +164,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['from'] = $this->from; diff --git a/src/Voice/Models/CreateCallResponse.php b/src/Voice/Models/CreateCallResponse.php index 5f11c8c..428e6ad 100644 --- a/src/Voice/Models/CreateCallResponse.php +++ b/src/Voice/Models/CreateCallResponse.php @@ -183,7 +183,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['accountId'] = $this->accountId; diff --git a/src/Voice/Models/Diversion.php b/src/Voice/Models/Diversion.php index 391d810..9026e22 100644 --- a/src/Voice/Models/Diversion.php +++ b/src/Voice/Models/Diversion.php @@ -52,7 +52,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['reason'] = $this->reason; diff --git a/src/Voice/Models/MachineDetectionConfiguration.php b/src/Voice/Models/MachineDetectionConfiguration.php index bd91b57..8745f83 100644 --- a/src/Voice/Models/MachineDetectionConfiguration.php +++ b/src/Voice/Models/MachineDetectionConfiguration.php @@ -140,7 +140,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['mode'] = $this->mode; diff --git a/src/Voice/Models/ModifyCallRecordingRequest.php b/src/Voice/Models/ModifyCallRecordingRequest.php index 08096c7..d2a5355 100644 --- a/src/Voice/Models/ModifyCallRecordingRequest.php +++ b/src/Voice/Models/ModifyCallRecordingRequest.php @@ -32,7 +32,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['state'] = $this->state; diff --git a/src/Voice/Models/ModifyCallRequest.php b/src/Voice/Models/ModifyCallRequest.php index acd8147..9807096 100644 --- a/src/Voice/Models/ModifyCallRequest.php +++ b/src/Voice/Models/ModifyCallRequest.php @@ -100,7 +100,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['state'] = $this->state; diff --git a/src/Voice/Models/ModifyConferenceRequest.php b/src/Voice/Models/ModifyConferenceRequest.php index bb5206a..7d9496b 100644 --- a/src/Voice/Models/ModifyConferenceRequest.php +++ b/src/Voice/Models/ModifyConferenceRequest.php @@ -87,7 +87,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['status'] = $this->status; diff --git a/src/Voice/Models/TranscribeRecordingRequest.php b/src/Voice/Models/TranscribeRecordingRequest.php index 63bd77c..a61e140 100644 --- a/src/Voice/Models/TranscribeRecordingRequest.php +++ b/src/Voice/Models/TranscribeRecordingRequest.php @@ -73,7 +73,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['callbackUrl'] = $this->callbackUrl; diff --git a/src/Voice/Models/Transcript.php b/src/Voice/Models/Transcript.php index b162f4f..cea62f6 100644 --- a/src/Voice/Models/Transcript.php +++ b/src/Voice/Models/Transcript.php @@ -38,7 +38,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['text'] = $this->text; diff --git a/src/Voice/Models/Transcription.php b/src/Voice/Models/Transcription.php index 784c03f..84057a9 100644 --- a/src/Voice/Models/Transcription.php +++ b/src/Voice/Models/Transcription.php @@ -52,7 +52,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['id'] = $this->id; diff --git a/src/Voice/Models/TranscriptionMetadata.php b/src/Voice/Models/TranscriptionMetadata.php index 402eaf7..2026499 100644 --- a/src/Voice/Models/TranscriptionMetadata.php +++ b/src/Voice/Models/TranscriptionMetadata.php @@ -54,7 +54,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['id'] = $this->id; diff --git a/src/Voice/Models/TranscriptionResponse.php b/src/Voice/Models/TranscriptionResponse.php index 618e935..4c9334a 100644 --- a/src/Voice/Models/TranscriptionResponse.php +++ b/src/Voice/Models/TranscriptionResponse.php @@ -31,7 +31,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['transcripts'] = isset($this->transcripts) ? diff --git a/src/WebRtc/Controllers/APIController.php b/src/WebRtc/Controllers/APIController.php index 3d017aa..354e85c 100644 --- a/src/WebRtc/Controllers/APIController.php +++ b/src/WebRtc/Controllers/APIController.php @@ -36,14 +36,14 @@ public function __construct($config, $httpCallBack = null) * Participants are idempotent, so relevant parameters must be set in this function if desired. * * - * @param string $accountId Account ID - * @param Models\Participant $body (optional) Participant parameters + * @param string $accountId Account ID + * @param Models\Participant|null $body (optional) Participant parameters * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createParticipant( - $accountId, - $body = null + string $accountId, + Models\Participant $body = null ) { //prepare query string for API call @@ -126,8 +126,8 @@ public function createParticipant( * @throws APIException Thrown if API call fails */ public function getParticipant( - $accountId, - $participantId + string $accountId, + string $participantId ) { //prepare query string for API call @@ -204,8 +204,8 @@ public function getParticipant( * @throws APIException Thrown if API call fails */ public function deleteParticipant( - $accountId, - $participantId + string $accountId, + string $participantId ) { //prepare query string for API call @@ -276,14 +276,14 @@ public function deleteParticipant( * Sessions are idempotent, so relevant parameters must be set in this function if desired. * * - * @param string $accountId Account ID - * @param Models\Session $body (optional) Session parameters + * @param string $accountId Account ID + * @param Models\Session|null $body (optional) Session parameters * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createSession( - $accountId, - $body = null + string $accountId, + Models\Session $body = null ) { //prepare query string for API call @@ -363,8 +363,8 @@ public function createSession( * @throws APIException Thrown if API call fails */ public function getSession( - $accountId, - $sessionId + string $accountId, + string $sessionId ) { //prepare query string for API call @@ -441,8 +441,8 @@ public function getSession( * @throws APIException Thrown if API call fails */ public function deleteSession( - $accountId, - $sessionId + string $accountId, + string $sessionId ) { //prepare query string for API call @@ -516,8 +516,8 @@ public function deleteSession( * @throws APIException Thrown if API call fails */ public function listSessionParticipants( - $accountId, - $sessionId + string $accountId, + string $sessionId ) { //prepare query string for API call @@ -591,18 +591,18 @@ public function listSessionParticipants( * Subscriptions can optionally be provided as part of this call. * * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @param string $participantId Participant ID - * @param Models\Subscriptions $body (optional) Subscriptions the participant should be created with + * @param string $accountId Account ID + * @param string $sessionId Session ID + * @param string $participantId Participant ID + * @param Models\Subscriptions|null $body (optional) Subscriptions the participant should be created with * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function addParticipantToSession( - $accountId, - $sessionId, - $participantId, - $body = null + string $accountId, + string $sessionId, + string $participantId, + Models\Subscriptions $body = null ) { //prepare query string for API call @@ -685,9 +685,9 @@ public function addParticipantToSession( * @throws APIException Thrown if API call fails */ public function removeParticipantFromSession( - $accountId, - $sessionId, - $participantId + string $accountId, + string $sessionId, + string $participantId ) { //prepare query string for API call @@ -763,9 +763,9 @@ public function removeParticipantFromSession( * @throws APIException Thrown if API call fails */ public function getParticipantSubscriptions( - $accountId, - $sessionId, - $participantId + string $accountId, + string $sessionId, + string $participantId ) { //prepare query string for API call @@ -843,18 +843,18 @@ public function getParticipantSubscriptions( * `Subscriptions` object to remove all subscriptions. * * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @param string $participantId Participant ID - * @param Models\Subscriptions $body (optional) Initial state + * @param string $accountId Account ID + * @param string $sessionId Session ID + * @param string $participantId Participant ID + * @param Models\Subscriptions|null $body (optional) Initial state * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function updateParticipantSubscriptions( - $accountId, - $sessionId, - $participantId, - $body = null + string $accountId, + string $sessionId, + string $participantId, + Models\Subscriptions $body = null ) { //prepare query string for API call diff --git a/src/WebRtc/Models/AccountsParticipantsResponse.php b/src/WebRtc/Models/AccountsParticipantsResponse.php index 50974f1..87695c1 100644 --- a/src/WebRtc/Models/AccountsParticipantsResponse.php +++ b/src/WebRtc/Models/AccountsParticipantsResponse.php @@ -40,7 +40,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['participant'] = $this->participant; diff --git a/src/WebRtc/Models/Participant.php b/src/WebRtc/Models/Participant.php index 81dda05..7aa3962 100644 --- a/src/WebRtc/Models/Participant.php +++ b/src/WebRtc/Models/Participant.php @@ -81,7 +81,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['id'] = $this->id; diff --git a/src/WebRtc/Models/ParticipantSubscription.php b/src/WebRtc/Models/ParticipantSubscription.php index 74ba85e..8d484f8 100644 --- a/src/WebRtc/Models/ParticipantSubscription.php +++ b/src/WebRtc/Models/ParticipantSubscription.php @@ -32,7 +32,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['participantId'] = $this->participantId; diff --git a/src/WebRtc/Models/Session.php b/src/WebRtc/Models/Session.php index ba76c05..ca1a70c 100644 --- a/src/WebRtc/Models/Session.php +++ b/src/WebRtc/Models/Session.php @@ -38,7 +38,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['id'] = $this->id; diff --git a/src/WebRtc/Models/Subscriptions.php b/src/WebRtc/Models/Subscriptions.php index e57572d..499aba4 100644 --- a/src/WebRtc/Models/Subscriptions.php +++ b/src/WebRtc/Models/Subscriptions.php @@ -42,7 +42,7 @@ public function __construct() /** * Encode this object to JSON */ - public function jsonSerialize() + public function jsonSerialize(): array { $json = array(); $json['sessionId'] = $this->sessionId; diff --git a/tests/ApiTest.php b/tests/ApiTest.php index d8e476e..d621ee3 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -88,7 +88,7 @@ public function testCreateCallAndGetCallState() { $this->assertTrue(strlen($callId) > 0); $this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime')); - sleep(25); + sleep(20); //get phone call information $response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId); @@ -120,7 +120,7 @@ public function testCreateCallWithAmdAndGetCallState() { $callId = $response->getResult()->callId; $this->assertTrue(strlen($callId) > 0); - sleep(25); + sleep(20); //get phone call information $response = $this->bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId);