for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace Aggrego\Domain\Api\Domain\Query\GetUnit;
use Aggrego\Domain\Model\Unit\Unit;
class Response
{
public const INVALID = 'invalid';
public const DONE = 'done';
/** @var string */
private $profile;
private $versionNumber;
private $status;
private $body;
private function __construct(string $profile, string $versionNumber, string $status, string $body)
$this->profile = $profile;
$this->versionNumber = $versionNumber;
$this->status = $status;
$this->body = $body;
}
public static function createInvalidResponse(Query $query): self
return new self(
$query->getProfile()->getName()->getValue(),
$query->getProfile()->getVersion()->getValue(),
self::INVALID,
''
);
public static function createValidResponse(Unit $unit): self
$profile = $unit->getProfile();
$profile->getName()->getValue(),
$profile->getVersion()->getValue(),
self::DONE,
$unit->getData()->getValue()
public function getProfileName(): string
return $this->profile;
public function getVersionNumber(): string
return $this->versionNumber;
public function getStatus(): string
return $this->status;
public function getBody(): string
return (string)$this->body;