src/Google/AdsApi/AdWords/Query/QueryValidator.php
private static function validateQuery(
        $awqlString,
        $requiredKeywords,
        $forbiddenKeywords
    ) {
        if (empty($awqlString)) {
            return ValidationResult::fail('The AWQL string must not be' .
                ' null or empty');
        }

        if (!self::containAllKeywords($awqlString, $requiredKeywords)) {
            return ValidationResult::fail(
                sprintf(
                    'The AWQL string must contain %s clause(s).',
                    implode(', ', $requiredKeywords)
                )
            );
        }

        if (self::containAnyKeywords($awqlString, $forbiddenKeywords)) {
            return ValidationResult::fail(
                sprintf(
                    'The AWQL string must not contain %s clauses.',
                    implode(', ', $forbiddenKeywords)
                )
            );
        }

        return ValidationResult::pass();
    }
private static function validateQuery(
        $awqlString,
        $requiredKeywords,
        $forbiddenKeywords
    ) {
        if (empty($awqlString)) {
            return ValidationResult::fail('The AWQL string must not be' .
                ' null or empty');
        }

        if (!self::containAllKeywords($awqlString, $requiredKeywords)) {
            return ValidationResult::fail(
                sprintf(
                    'The AWQL string must contain %s clause(s).',
                    implode(', ', $requiredKeywords)
                )
            );
        }

        if (self::containAnyKeywords($awqlString, $forbiddenKeywords)) {
            return ValidationResult::fail(
                sprintf(
                    'The AWQL string must not contain %s clauses.',
                    implode(', ', $forbiddenKeywords)
                )
            );
        }

        return ValidationResult::pass();
    }
private static function validateQuery ( $ awqlString , $ requiredKeywords , $ forbiddenKeywords ) { if ( empty ( $ awqlString ) ) { return ValidationResult :: fail ( 'The AWQL string must not be' . ' null or empty' ) ; } if ( ! self :: containAllKeywords ( $ awqlString , $ requiredKeywords ) ) { return ValidationResult :: fail ( sprintf ( 'The AWQL string must contain %s clause(s).' , implode ( ', ' , $ requiredKeywords ) ) ) ; } if ( self :: containAnyKeywords ( $ awqlString , $ forbiddenKeywords ) ) { return ValidationResult :: fail ( sprintf ( 'The AWQL string must not contain %s clauses.' , implode ( ', ' , $ forbiddenKeywords ) ) ) ; } return ValidationResult :: pass ( ) ; }
Checks if the AWQL string contains the required clause opening keywords,
but not the forbidden ones.

@param string $awqlString the AWQL string to check
@param string[] $requiredKeywords the opening keywords (e.g. SELECT,
FROM, WHERE, ORDER BY) for the required clauses
@param string[] $forbiddenKeywords the opening keywords (e.g. SELECT,
FROM, WHERE, ORDER BY) for the forbidden clauses
@return ValidationResult the object containing whether the validation
is passed or failed with detail explanation
Checks if the AWQL string contains the required clause opening keywords but not the forbidden ones .