-
Notifications
You must be signed in to change notification settings - Fork 54
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
Assert values are correct for api context bunq/sdk_php#35 #135
Assert values are correct for api context bunq/sdk_php#35 #135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OGKevin yours.
src/Context/ApiContext.php
Outdated
@@ -104,6 +105,9 @@ public static function create( | |||
array $permittedIps = [], | |||
string $proxyUrl = null | |||
): ApiContext { | |||
InstallationUtil::assertDeviceDescriptionIsValid($description); | |||
InstallationUtil::assertAllIpIsValid($permittedIps); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plural in $permittedIps
-> $allPermittedIp
src/Util/InstallationUtil.php
Outdated
@@ -23,6 +23,7 @@ | |||
const ERROR_EMPTY_DESCRIPTION = 'Description cannot be empty.'; | |||
const ERROR_INVALID_IP_ADDRESS = 'Invalid ip address "%s"'; | |||
const ERROR_CANNOT_CREATE_API_KEY_PRODUCTION = 'Cannot automatically create API key for production.'; | |||
const ERROR_INVALID_DEVICE_DESCRIPTION = '"%s" can not be used as a device description.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a reason here? This error is not really clear.
* @return bool | ||
* @throws BunqException | ||
*/ | ||
public static function assertDeviceDescriptionIsValid(string $deviceDescription): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep forgetting about this,.. do we have typehints for string
in SDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, in the SDK we do not suffer from auto casting and therefore we indeed type hint strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
Requested changes have not been provided yet.
@sandervdo pushed, please 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
References #35