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