printf("Placement with URL '%s' and ID '%s' was added.\n", $adGroupCriterion->criterion->url, $adGroupCriterion->criterion->id);
        }
    }
    // Check for partial failures.
    if (isset($result->partialFailureErrors)) {
        foreach ($result->partialFailureErrors as $error) {
            $index = ErrorUtils::GetSourceOperationIndex($error);
            if (isset($index)) {
                $adGroupCriterion = $operations[$index]->operand;
                printf("Placement with URL '%s' failed with error '%s'.\n", $adGroupCriterion->criterion->url, $error->errorString);
            } else {
                printf("Operations failed with error '%s'.\n", $error->errorString);
            }
        }
    }
}
// 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.
    HandlePartialFailuresExample($user, $adGroupId);
} catch (Exception $e) {
    printf("An error has occurred: %s\n", $e->getMessage());
}
 public function testHandlePartialFailuresExample()
 {
     HandlePartialFailuresExample($this->user, $this->adGroupId);
 }