Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
RemoveFormDiff
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 11
132
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
 getRemovedFormId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getRepresentationDiff
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getGrammaticalFeaturesDiff
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
3namespace Wikibase\Lexeme\Domain\Diff;
4
5use Diff\DiffOp\Diff\Diff;
6use Wikibase\Lexeme\Domain\Model\FormId;
7
8/**
9 * @license GPL-2.0-or-later
10 * @phan-file-suppress PhanPluginNeverReturnMethod
11 */
12class RemoveFormDiff implements FormDiff {
13
14    use Nonserializable;
15
16    /**
17     * @var FormId
18     */
19    private $formId;
20
21    /**
22     * @var Diff
23     */
24    private $diffOps;
25
26    public function __construct( FormId $formId, Diff $diffOps ) {
27        $this->formId = $formId;
28        $this->diffOps = $diffOps;
29    }
30
31    public function getRemovedFormId() {
32        return $this->formId;
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}