Skip to content

Commit

Permalink
TASK: Improve flow cr:status
Browse files Browse the repository at this point in the history
Followup to neos/neos-development-collection#4846

- require a $details string for all non-ok status
- print "No details available." if verbose and non-ok and no details are available
- dont wortbreak details in verbose mode but print them with indentation of 2 full line per line
- print new line after printing details
- add details to AssetUsageProjection's setupRequired
  • Loading branch information
mhsdesign committed Jan 23, 2024
1 parent 83fcd5d commit 48cee02
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Classes/Projection/ProjectionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
final readonly class ProjectionStatus
{
public function __construct(
private function __construct(
public ProjectionStatusType $type,
public string $details,
) {
Expand All @@ -18,18 +18,35 @@ public static function ok(): self
return new self(ProjectionStatusType::OK, '');
}

/**
* @param non-empty-string $details
*/
public static function error(string $details): self
{
return new self(ProjectionStatusType::ERROR, $details);
}

public static function setupRequired(string $details = ''): self
/**
* @param non-empty-string $details
*/
public static function setupRequired(string $details): self
{
return new self(ProjectionStatusType::SETUP_REQUIRED, $details);
}

public static function replayRequired(string $details = ''): self
/**
* @param non-empty-string $details
*/
public static function replayRequired(string $details): self
{
return new self(ProjectionStatusType::REPLAY_REQUIRED, $details);
}

/**
* @param non-empty-string $details
*/
public function withDetails(string $details): self
{
return new self($this->type, $details);
}
}

0 comments on commit 48cee02

Please sign in to comment.