Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| AddFormRequest | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| getChangeOp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLexemeId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getBaseRevId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Wikibase\Lexeme\MediaWiki\Api; |
| 4 | |
| 5 | use Wikibase\Lexeme\DataAccess\ChangeOp\ChangeOpFormAdd; |
| 6 | use Wikibase\Lexeme\Domain\Model\LexemeId; |
| 7 | use Wikibase\Repo\ChangeOp\ChangeOp; |
| 8 | |
| 9 | /** |
| 10 | * @license GPL-2.0-or-later |
| 11 | */ |
| 12 | class AddFormRequest { |
| 13 | |
| 14 | private LexemeId $lexemeId; |
| 15 | private ChangeOp $editFormchangeOp; |
| 16 | |
| 17 | /** |
| 18 | * @var int|null |
| 19 | */ |
| 20 | private $baseRevId; |
| 21 | |
| 22 | /** |
| 23 | * @param LexemeId $lexemeId |
| 24 | * @param ChangeOp $editFormChangeOp |
| 25 | * @param int|null $baseRevId |
| 26 | */ |
| 27 | public function __construct( |
| 28 | LexemeId $lexemeId, |
| 29 | ChangeOp $editFormChangeOp, |
| 30 | $baseRevId |
| 31 | ) { |
| 32 | // TODO: consider the below in appropriate validation |
| 33 | // Assert::parameterElementType( ItemId::class, $grammaticalFeatures, '$grammaticalFeatures' ); |
| 34 | // Assert::parameter( !$representations->isEmpty(), '$representations', 'should not be empty' ); |
| 35 | |
| 36 | $this->lexemeId = $lexemeId; |
| 37 | $this->editFormchangeOp = $editFormChangeOp; |
| 38 | $this->baseRevId = $baseRevId; |
| 39 | } |
| 40 | |
| 41 | public function getChangeOp(): ChangeOpFormAdd { |
| 42 | return new ChangeOpFormAdd( $this->editFormchangeOp ); |
| 43 | } |
| 44 | |
| 45 | public function getLexemeId(): LexemeId { |
| 46 | return $this->lexemeId; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @return int|null |
| 51 | */ |
| 52 | public function getBaseRevId() { |
| 53 | return $this->baseRevId; |
| 54 | } |
| 55 | |
| 56 | } |