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