foreach ($operationIndicesToRemove as $operationIndex) {
                unset($operations[$operationIndex]);
            }
        }
    }
    if (sizeof($operations) > 0) {
        // Retry the mutate request.
        $result = $adGroupAdService->mutate($operations);
        // Display results.
        foreach ($result->value as $adGroupAd) {
            printf("Text ad with headline '%s' and ID '%s' was added.\n", $adGroupAd->ad->headline, $adGroupAd->ad->id);
        }
    } else {
        print "All the operations were invalid with non-exemptable errors.\n";
    }
}
// Don't run the example if the file is being included.
if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
    return;
}
try {
    // Get AdWordsUser from credentials in "../auth.ini"
    // relative to the AdWordsUser.php file's directory.
    $user = new AdWordsUser();
    // Log every SOAP XML request and response.
    $user->LogAll();
    // Run the example.
    HandlePolicyViolationErrorExample($user, $adGroupId);
} catch (Exception $e) {
    printf("An error has occurred: %s\n", $e->getMessage());
}
 public function testHandlePolicyViolationErrorExample()
 {
     HandlePolicyViolationErrorExample($this->user, $this->adGroupId);
 }