Merge pull request #109 from indeed-a-genius/patch-1

Incorrect listPageRules() conditions for optional parameters
This commit is contained in:
Junade
2019-09-20 02:43:43 +01:00
committed by GitHub

View File

@@ -73,19 +73,19 @@ class PageRules implements API
string $direction = null,
string $match = null
): array {
if ($status === null && !in_array($status, ['active', 'disabled'])) {
if ($status != null && !in_array($status, ['active', 'disabled'])) {
throw new EndpointException('Page Rules can only be listed by status of active or disabled.');
}
if ($order === null && !in_array($order, ['status', 'priority'])) {
if ($order != null && !in_array($order, ['status', 'priority'])) {
throw new EndpointException('Page Rules can only be ordered by status or priority.');
}
if ($direction === null && !in_array($direction, ['asc', 'desc'])) {
if ($direction != null && !in_array($direction, ['asc', 'desc'])) {
throw new EndpointException('Direction of Page Rule ordering can only be asc or desc.');
}
if ($match === null && !in_array($match, ['all', 'any'])) {
if ($match != null && !in_array($match, ['all', 'any'])) {
throw new EndpointException('Match can only be any or all.');
}