Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 11 |
CRAP | |
0.00% |
0 / 1 |
AddFormDiff | |
0.00% |
0 / 12 |
|
0.00% |
0 / 11 |
132 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getAddedForm | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRepresentationDiff | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getGrammaticalFeaturesDiff | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getStatementsDiff | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isAtomic | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
toArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
count | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getOperations | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getArrayCopy | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Wikibase\Lexeme\Domain\Diff; |
4 | |
5 | use Diff\DiffOp\Diff\Diff; |
6 | use Wikibase\Lexeme\Domain\Model\Form; |
7 | |
8 | /** |
9 | * @license GPL-2.0-or-later |
10 | * @phan-file-suppress PhanPluginNeverReturnMethod |
11 | */ |
12 | class AddFormDiff implements FormDiff { |
13 | |
14 | use Nonserializable; |
15 | |
16 | /** |
17 | * @var Form |
18 | */ |
19 | private $form; |
20 | |
21 | /** |
22 | * @var Diff |
23 | */ |
24 | private $diffOps; |
25 | |
26 | public function __construct( Form $addedForm, Diff $diffOps ) { |
27 | $this->form = $addedForm; |
28 | $this->diffOps = $diffOps; |
29 | } |
30 | |
31 | public function getAddedForm() { |
32 | return $this->form; |
33 | } |
34 | |
35 | /** |
36 | * @return Diff |
37 | */ |
38 | public function getRepresentationDiff() { |
39 | return $this->diffOps['representations'] ?? new Diff( [] ); |
40 | } |
41 | |
42 | /** |
43 | * @return Diff |
44 | */ |
45 | public function getGrammaticalFeaturesDiff() { |
46 | return $this->diffOps['grammaticalFeatures'] ?? new Diff( [] ); |
47 | } |
48 | |
49 | /** |
50 | * @return Diff |
51 | */ |
52 | public function getStatementsDiff() { |
53 | return $this->diffOps['claim'] ?? new Diff( [] ); |
54 | } |
55 | |
56 | public function getType(): string { |
57 | return 'diff'; |
58 | } |
59 | |
60 | public function isAtomic(): bool { |
61 | return false; |
62 | } |
63 | |
64 | public function toArray( ?callable $valueConverter = null ): array { |
65 | throw new \LogicException( 'toArray() is not implemented' ); |
66 | } |
67 | |
68 | public function count(): int { |
69 | return $this->diffOps->count(); |
70 | } |
71 | |
72 | public function getOperations(): array { |
73 | // Due to the way this DiffOp is structured the default implementation would return nothing |
74 | throw new \LogicException( "getOperations() is not implemented" ); |
75 | } |
76 | |
77 | public function getArrayCopy(): array { |
78 | // Due to the way this DiffOp is structured the default implementation would return nothing |
79 | throw new \LogicException( "getArrayCopy() is not implemented" ); |
80 | } |
81 | |
82 | } |