private function extractPatchOperations($patchDocument)
{
$patchDocument = json_decode($patchDocument);
if ($this->isEmptyPatchDocument($patchDocument)) {
$exceptionMessage = sprintf("Unable to extract patch operations from '%s'", json_encode($patchDocument));
throw new InvalidOperationException($exceptionMessage);
}
$patchOperations = array();
foreach ($patchDocument as $index => $possiblePatchOperation) {
$operation = $this->patchOperationFactory($possiblePatchOperation);
if ($operation instanceof Operation) {
$patchOperations[] = $operation;
}
}
return $patchOperations;
}