Code Duplication    Length = 12-12 lines in 2 locations

src/Jarboe/Table/Fields/Traits/Errors.php 2 locations

@@ 9-20 (lines=12) @@
6
7
trait Errors
8
{
9
    public function hasError(ViewErrorBag $errors, $locale = null): bool
10
    {
11
        if ($locale) {
12
            return $errors->has(sprintf('%s.%s', $this->name(), $locale));
13
        }
14
15
        if ($this->belongsToArray()) {
16
            return $errors->has($this->getDotPatternName());
17
        }
18
19
        return $errors->has($this->name());
20
    }
21
22
    public function getErrors(ViewErrorBag $errors, $locale = null): array
23
    {
@@ 22-33 (lines=12) @@
19
        return $errors->has($this->name());
20
    }
21
22
    public function getErrors(ViewErrorBag $errors, $locale = null): array
23
    {
24
        if ($locale) {
25
            return $errors->get(sprintf('%s.%s', $this->name(), $locale));
26
        }
27
28
        if ($this->belongsToArray()) {
29
            return $errors->get($this->getDotPatternName());
30
        }
31
32
        return $errors->get($this->name());
33
    }
34
35
    abstract public function name(string $name = null);
36
    abstract public function belongsToArray(): bool;