Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| EntitySchemaStatus | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| newEdit | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getEntitySchemaId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare( strict_types = 1 ); |
| 4 | |
| 5 | namespace EntitySchema\DataAccess; |
| 6 | |
| 7 | use EntitySchema\Domain\Model\EntitySchemaId; |
| 8 | use MediaWiki\Context\IContextSource; |
| 9 | use MediaWiki\User\UserIdentity; |
| 10 | use Wikibase\Repo\TempUserStatus; |
| 11 | use Wikimedia\Assert\Assert; |
| 12 | |
| 13 | /** |
| 14 | * A Status representing the result of an EntitySchema edit. |
| 15 | * |
| 16 | * Note that even an OK status does not necessarily mean that a new edit was made |
| 17 | * (it might have been a null edit). |
| 18 | * |
| 19 | * @inherits TempUserStatus<array{savedTempUser:?UserIdentity,context:IContextSource,id:EntitySchemaId}> |
| 20 | * @license GPL-2.0-or-later |
| 21 | */ |
| 22 | class EntitySchemaStatus extends TempUserStatus { |
| 23 | |
| 24 | public static function newEdit( |
| 25 | EntitySchemaId $id, |
| 26 | ?UserIdentity $savedTempUser, |
| 27 | IContextSource $context |
| 28 | ): self { |
| 29 | return self::newTempUserStatus( [ |
| 30 | 'id' => $id, |
| 31 | ], $savedTempUser, $context ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * The ID of the EntitySchema touched by this edit. |
| 36 | * (It may have been created by the edit with a freshly assigned ID.) |
| 37 | * Only meaningful if the status is {@link self::isOK() OK}. |
| 38 | */ |
| 39 | public function getEntitySchemaId(): EntitySchemaId { |
| 40 | Assert::precondition( $this->isOK(), '$this->isOK()' ); |
| 41 | return $this->getValue()['id']; |
| 42 | } |
| 43 | |
| 44 | } |