2024-01-04 21:51:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Values;
|
|
|
|
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
final class ScanResultCollection extends Collection
|
|
|
|
{
|
|
|
|
public static function create(): self
|
|
|
|
{
|
|
|
|
return new self();
|
|
|
|
}
|
|
|
|
|
2024-04-18 11:27:07 +00:00
|
|
|
/** @return Collection<array-key, ScanResult> */
|
2024-01-04 21:51:32 +00:00
|
|
|
public function valid(): Collection
|
|
|
|
{
|
|
|
|
return $this->filter(static fn (ScanResult $result): bool => $result->isValid());
|
|
|
|
}
|
|
|
|
|
2024-04-18 11:27:07 +00:00
|
|
|
/** @return Collection<array-key, ScanResult> */
|
2024-01-04 21:51:32 +00:00
|
|
|
public function success(): Collection
|
|
|
|
{
|
|
|
|
return $this->filter(static fn (ScanResult $result): bool => $result->isSuccess());
|
|
|
|
}
|
|
|
|
|
2024-04-18 11:27:07 +00:00
|
|
|
/** @return Collection<array-key, ScanResult> */
|
2024-01-04 21:51:32 +00:00
|
|
|
public function skipped(): Collection
|
|
|
|
{
|
|
|
|
return $this->filter(static fn (ScanResult $result): bool => $result->isSkipped());
|
|
|
|
}
|
|
|
|
|
2024-04-18 11:27:07 +00:00
|
|
|
/** @return Collection<array-key, ScanResult> */
|
2024-01-04 21:51:32 +00:00
|
|
|
public function error(): Collection
|
|
|
|
{
|
|
|
|
return $this->filter(static fn (ScanResult $result): bool => $result->isError());
|
|
|
|
}
|
|
|
|
}
|