-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatcherInterface.php
More file actions
44 lines (38 loc) · 1.43 KB
/
PatcherInterface.php
File metadata and controls
44 lines (38 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Lindelius\JsonPatch;
use Lindelius\JsonPatch\Exception\PatchException;
interface PatcherInterface
{
/**
* Register a given path as "protected", meaning that no patch operation
* that modifies the value of the given path may be executed.
*
* @param string $path The JSON Pointer path that should be protected.
* @return self
*/
public function addProtectedPath(string $path): self;
/**
* Get all paths that have been registered as "protected".
*
* @return string[] The JSON Pointer paths that are protected.
*/
public function getProtectedPaths(): array;
/**
* Patch a given document with a given set of operations.
*
* @param array $document The document to apply the patches to.
* @param iterable $operations The JSON Patch operations in array format.
* @return array The document after the patch operations have been applied.
* @throws PatchException
*/
public function patch(array $document, iterable $operations): array;
/**
* Patch a given document with a given set of operations.
*
* @param array $document The document to apply the patches to.
* @param string $json The JSON Patch operations as a JSON string.
* @return array The document after the patch operations have been applied.
* @throws PatchException
*/
public function patchFromJson(array $document, string $json): array;
}