Skip to content

Fix #52 - cast 'NUMBER_SEARCH_CRITERIA' as (string). #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
11 changes: 10 additions & 1 deletion numbers/search-available.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
$client = new \Vonage\Client($basic);

/** @var IterableAPICollection $response */
/** Note: be careful when specifying "NUMBER_SEARCH_CRITERIA" environment variable:
* surround it with quotes if it has a leading zero, otherwise the (string) conversion
* will assume it is an Octal number and convert it. e.g., (string)0123 results in "83".
* NUMBER_SEARCH_PATTERN will be one of 0 (search for numbers that start with pattern);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with the warning above, but an we remove the options listed here? The allowed options are all listed on https://developer.nexmo.com/numbers/code-snippets/search-available/php, and it's expected that these snippets are being used with the documentation versus stand-alone.

* 1 (search for numbers that contain pattern), or 2 (search for numbers that end with pattern).
* VONAGE_NUMBER_TYPE must be one of: landline, mobile-lvn or landline-toll-free
* VONAGE_NUMBER_FEATURES Must be one of: SMS, VOICE, SMS,VOICE, MMS, SMS,MMS, VOICE,MMS
* or SMS,MMS,VOICE
*/
$filter = new AvailableNumbers([
"pattern" => (int) NUMBER_SEARCH_CRITERIA,
"pattern" => (string)NUMBER_SEARCH_CRITERIA,
"search_pattern" => (int) NUMBER_SEARCH_PATTERN,
"type" => VONAGE_NUMBER_TYPE,
"features" => VONAGE_NUMBER_FEATURES,
Expand Down