Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
GroupOlxFeedValidationResult
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isValid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 firstError
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 all
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace ImovelZapAi\Publishing\Connectors\GroupOlx\Application\Data;
6
7/**
8 * Resultado de validação do feed Grupo OLX — nunca usa Exception para erros de regra.
9 */
10final readonly class GroupOlxFeedValidationResult
11{
12    /**
13     * @param  list<string>  $errors
14     */
15    public function __construct(
16        public array $errors,
17    ) {}
18
19    public function isValid(): bool
20    {
21        return $this->errors === [];
22    }
23
24    public function firstError(): ?string
25    {
26        return $this->errors[0] ?? null;
27    }
28
29    /** @return list<string> */
30    public function all(): array
31    {
32        return $this->errors;
33    }
34}