src/Google/AdsApi/AdWords/Query/v201809/ServiceQuery.php
private static function validate($awqlString, $startIndex, $pageSize)
    {
        $validationResult = QueryValidator::validateServiceQuery(
            $awqlString,
            false
        );
        if ($validationResult->isFailed()) {
            throw new InvalidArgumentException(
                'The service query string is invalid. Validation fail reason: '.
                $validationResult->getFailReason()
            );
        }

        // The `startIndex` and `pageSize` arguments are optional for
        // constructing a `ServiceQuery` object. They must either be both null,
        // or both not null.

        if (is_null($startIndex) !== is_null($pageSize)) {
            throw new InvalidArgumentException('Start index and page size' .
                ' must be both null, or both not null.');
        }

        if (!is_null($startIndex)) {
            if (!is_int($startIndex)) {
                throw new InvalidArgumentException('The start index must be' .
                    ' an integer.');
            }

            if ($startIndex < 0) {
                throw new OutOfBoundsException('The start index must be 0 or' .
                    ' a positive number.');
            }
        }

        if (!is_null($pageSize)) {
            if (!is_int($pageSize)) {
                throw new InvalidArgumentException('The page size must be' .
                    ' an integer.');
            }

            if ($pageSize < 1) {
                throw new OutOfBoundsException('The page size must be a' .
                    ' positive number.');
            }
        }
    }
private static function validate($awqlString, $startIndex, $pageSize)
    {
        $validationResult = QueryValidator::validateServiceQuery(
            $awqlString,
            false
        );
        if ($validationResult->isFailed()) {
            throw new InvalidArgumentException(
                'The service query string is invalid. Validation fail reason: '.
                $validationResult->getFailReason()
            );
        }

        // The `startIndex` and `pageSize` arguments are optional for
        // constructing a `ServiceQuery` object. They must either be both null,
        // or both not null.

        if (is_null($startIndex) !== is_null($pageSize)) {
            throw new InvalidArgumentException('Start index and page size' .
                ' must be both null, or both not null.');
        }

        if (!is_null($startIndex)) {
            if (!is_int($startIndex)) {
                throw new InvalidArgumentException('The start index must be' .
                    ' an integer.');
            }

            if ($startIndex < 0) {
                throw new OutOfBoundsException('The start index must be 0 or' .
                    ' a positive number.');
            }
        }

        if (!is_null($pageSize)) {
            if (!is_int($pageSize)) {
                throw new InvalidArgumentException('The page size must be' .
                    ' an integer.');
            }

            if ($pageSize < 1) {
                throw new OutOfBoundsException('The page size must be a' .
                    ' positive number.');
            }
        }
    }
private static function validate ( $ awqlString , $ startIndex , $ pageSize ) { $ validationResult = QueryValidator :: validateServiceQuery ( $ awqlString , false ) ; if ( $ validationResult -> isFailed ( ) ) { throw new InvalidArgumentException ( 'The service query string is invalid. Validation fail reason: ' . $ validationResult -> getFailReason ( ) ) ; } // The `startIndex` and `pageSize` arguments are optional for // constructing a `ServiceQuery` object. They must either be both null, // or both not null. if ( is_null ( $ startIndex ) !== is_null ( $ pageSize ) ) { throw new InvalidArgumentException ( 'Start index and page size' . ' must be both null, or both not null.' ) ; } if ( ! is_null ( $ startIndex ) ) { if ( ! is_int ( $ startIndex ) ) { throw new InvalidArgumentException ( 'The start index must be' . ' an integer.' ) ; } if ( $ startIndex < 0 ) { throw new OutOfBoundsException ( 'The start index must be 0 or' . ' a positive number.' ) ; } } if ( ! is_null ( $ pageSize ) ) { if ( ! is_int ( $ pageSize ) ) { throw new InvalidArgumentException ( 'The page size must be' . ' an integer.' ) ; } if ( $ pageSize < 1 ) { throw new OutOfBoundsException ( 'The page size must be a' . ' positive number.' ) ; } } }
Validates the arguments for constructing a service query object.

@param string $awqlString the AWQL string without the LIMIT clause
@param int $startIndex the start index of the first page
@param int $pageSize the count of entries to be fetched in each page

@throws InvalidArgumentException when the AWQL string is null or empty,
or contains a LIMIT clause
@throws OutOfBoundsException when the start index is a negative number,
or when the page size is 0 or a negative number
Validates the arguments for constructing a service query object .