for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare( strict_types = 1 );
namespace WMDE\Fundraising\AddressChangeContext\UseCases\ChangeAddress;
class ChangeAddressResponse {
public const ERROR_ADDRESS_NOT_FOUND = 'Address not found';
/**
* @var array<string>
*/
private array $errorMessages;
* @param array<string> $errorMessages
private function __construct( array $errorMessages = [] ) {
$this->errorMessages = $errorMessages;
}
*
* @return ChangeAddressResponse
public static function newErrorResponse( array $errorMessages ): self {
return new self( $errorMessages );
public static function newSuccessResponse(): self {
return new self();
public function isSuccess(): bool {
return count( $this->errorMessages ) === 0;
* @return array<string>
public function getErrors(): array {
return $this->errorMessages;