Completed
Pull Request — master (#1)
by Tim
65:22
created

ChangeAddressResponse::newSuccessResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\AddressChange\UseCases\ChangeAddress;
6
7
class ChangeAddressResponse {
8
9
	private $errorMessages;
10
11
	private function __construct( array $errorMessages = [] ) {
12
		$this->errorMessages = $errorMessages;
13
	}
14
15
	public static function newErrorResponse( array $errorMessages ): self {
16
		return new self( $errorMessages );
17
	}
18
19
	public static function newSuccessResponse(): self {
20
		return new self();
21
	}
22
23
	public function isSuccess(): bool {
24
		return count( $this->errorMessages ) === 0;
25
	}
26
27
	public function getErrors(): array {
28
		return $this->errorMessages;
29
	}
30
31
}