Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| PageUpdaterStatus | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| newUpdater | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getPageUpdater | |
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 MediaWiki\Context\IContextSource; |
| 8 | use MediaWiki\Storage\PageUpdater; |
| 9 | use MediaWiki\User\UserIdentity; |
| 10 | use Wikibase\Repo\TempUserStatus; |
| 11 | use Wikimedia\Assert\Assert; |
| 12 | |
| 13 | /** |
| 14 | * A Status representing the result of a {@link MediaWikiPageUpdaterFactory}: |
| 15 | * the PageUpdater, and possibly any temporary account that was created. |
| 16 | * |
| 17 | * @inherits TempUserStatus<array{savedTempUser:?UserIdentity,context:IContextSource,pageUpdater:PageUpdater}> |
| 18 | * @license GPL-2.0-or-later |
| 19 | */ |
| 20 | class PageUpdaterStatus extends TempUserStatus { |
| 21 | |
| 22 | public static function newUpdater( |
| 23 | PageUpdater $pageUpdater, |
| 24 | ?UserIdentity $savedTempUser, |
| 25 | IContextSource $context |
| 26 | ): self { |
| 27 | return self::newTempUserStatus( [ |
| 28 | 'pageUpdater' => $pageUpdater, |
| 29 | ], $savedTempUser, $context ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * The newly created PageUpdater. |
| 34 | * Only meaningful if the status is {@link self::isOK() OK}. |
| 35 | */ |
| 36 | public function getPageUpdater(): PageUpdater { |
| 37 | Assert::precondition( $this->isOK(), '$this->isOK()' ); |
| 38 | return $this->getValue()['pageUpdater']; |
| 39 | } |
| 40 | |
| 41 | } |