-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDiffOp.php
More file actions
64 lines (56 loc) · 1.59 KB
/
Copy pathDiffOp.php
File metadata and controls
64 lines (56 loc) · 1.59 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare( strict_types = 1 );
namespace Diff\DiffOp;
use Countable;
use Serializable;
/**
* Interface for diff operations. A diff operation
* represents a change to a single element.
* In case the elements are maps or diffs, the resulting operation
* can be a Diff which contains its own list of DiffOp objects.
*
* @since 0.1
*
* @license BSD-3-Clause
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
interface DiffOp extends Serializable, Countable {
/**
* Returns a string identifier for the operation type.
*
* @since 0.1
*
* @return string
*/
public function getType(): string;
/**
* Returns if the operation is atomic, opposing to it
* being a composite that can contain one or more child elements.
*
* @since 0.1
*
* @return bool
*/
public function isAtomic(): bool;
/**
* Returns the DiffOp in array form.
*
* All element of the array with either be primitives or arrays, with the exception
* of complex values. For instance an add operation containing an object will have this
* object in the resulting array.
*
* This array form is particularly useful for serialization, as you can feed it
* to serialization functions such as json_encode() or serialize(), keeping in mind
* you might need extra handling for complex objects contained in the DiffOp.
*
* Roundtrips with DiffOpFactory::newFromArray.
*
* @since 0.5
*
* @param callable|null $valueConverter optional callback used to convert any
* complex values to arrays.
*
* @return array
*/
public function toArray( ?callable $valueConverter = null ): array;
}