/** * @param JsonPatch $patch * @param object|array $document * * @return mixed * * @throws OperationException */ public function apply(JsonPatch $patch, $document) { $documentCopy = $this->clone->cloneDocument($document); foreach ($patch->getOperations() as $operation) { $documentCopy = $operation($documentCopy, $this->facade); } return $documentCopy; }
/** * @dataProvider dataProvider */ public function testFromJson($expected, $data) { $patch = JsonPatch::fromJson($data); $this->assertEquals($expected, $patch->getOperations()); }