Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| UploadVerificationStatus | |
0.00% |
0 / 12 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
| setRecoverableError | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| setInvalidParameter | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| setApiData | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| setApiCode | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| isRecoverableError | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getInvalidParameter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| asApiMessage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | namespace MediaWiki\Upload; |
| 8 | |
| 9 | use MediaWiki\Api\ApiMessage; |
| 10 | use MediaWiki\Api\IApiMessage; |
| 11 | use StatusValue; |
| 12 | |
| 13 | /** |
| 14 | * A StatusValue for upload verification errors. |
| 15 | * |
| 16 | * This status will never have a value. It's only used to keep track of errors. |
| 17 | * |
| 18 | * @unstable |
| 19 | * @since 1.44 |
| 20 | * @extends StatusValue<never> |
| 21 | */ |
| 22 | class UploadVerificationStatus extends StatusValue { |
| 23 | |
| 24 | private bool $recoverableError = false; |
| 25 | private ?string $invalidParameter = null; |
| 26 | private ?array $apiData = null; |
| 27 | private ?string $apiCode = null; |
| 28 | |
| 29 | public function setRecoverableError( bool $recoverableError ): self { |
| 30 | $this->recoverableError = $recoverableError; |
| 31 | return $this; |
| 32 | } |
| 33 | |
| 34 | public function setInvalidParameter( string $invalidParameter ): self { |
| 35 | $this->invalidParameter = $invalidParameter; |
| 36 | return $this; |
| 37 | } |
| 38 | |
| 39 | public function setApiData( array $apiData ): self { |
| 40 | $this->apiData = $apiData; |
| 41 | return $this; |
| 42 | } |
| 43 | |
| 44 | public function setApiCode( string $apiCode ): self { |
| 45 | $this->apiCode = $apiCode; |
| 46 | return $this; |
| 47 | } |
| 48 | |
| 49 | public function isRecoverableError(): bool { |
| 50 | return $this->recoverableError; |
| 51 | } |
| 52 | |
| 53 | public function getInvalidParameter(): ?string { |
| 54 | return $this->invalidParameter; |
| 55 | } |
| 56 | |
| 57 | public function asApiMessage(): IApiMessage { |
| 58 | $messages = $this->getMessages(); |
| 59 | return ApiMessage::create( $messages[0], $this->apiCode, $this->apiData ); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** @deprecated class alias since 1.46 */ |
| 64 | class_alias( UploadVerificationStatus::class, 'UploadVerificationStatus' ); |