• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RonasIT / laravel-entity-generator / 21236534569

22 Jan 2026 04:53AM UTC coverage: 99.713% (-0.3%) from 100.0%
21236534569

Pull #241

github

web-flow
Merge 06991d18c into 962b971b7
Pull Request #241: [239]: append field modifiers instead of uppercase options

161 of 164 new or added lines in 17 files covered. (98.17%)

1 existing line in 1 file now uncovered.

1043 of 1046 relevant lines covered (99.71%)

11.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/src/Collections/FieldsCollection.php
1
<?php
2

3
namespace RonasIT\Support\Collections;
4

5
use Countable;
6
use Illuminate\Support\Collection;
7
use IteratorAggregate;
8
use RonasIT\Support\Enums\FieldModifierEnum;
9
use RonasIT\Support\Enums\FieldTypeEnum;
10
use RonasIT\Support\ValueObjects\Field;
11
use Traversable;
12

13
final readonly class FieldsCollection implements Countable, IteratorAggregate
14
{
15
    private Collection $fields;
16

17
    public function __construct(iterable $fields = [])
18
    {
19
        $this->fields = collect($fields);
38✔
20
    }
21

22
    public function getIterator(): Traversable
23
    {
24
        return $this->fields->getIterator();
23✔
25
    }
26

27
    public function count(): int
28
    {
NEW
29
        return $this->fields->count();
×
30
    }
31

32
    public function merge(array $newFields): self
33
    {
34
        return new self($this->fields->concat($newFields));
31✔
35
    }
36

37
    public function getFields(): array
38
    {
NEW
39
        return $this->fields->all();
×
40
    }
41

42
    public function replaceModifier(
43
        FieldTypeEnum $type,
44
        FieldModifierEnum $originalModifier,
45
        FieldModifierEnum $newModifier,
46
    ): self {
47
        $fields = $this->fields->map(
7✔
48
            fn (Field $field) => ($field->type === $type)
7✔
49
                ? $field->replaceModifier($originalModifier, $newModifier)
2✔
50
                : $field,
7✔
51
        );
7✔
52

53
        return new self($fields);
7✔
54
    }
55

56
    public function removeModifier(FieldTypeEnum $type, FieldModifierEnum $removeModifier): self
57
    {
58
        $fields = $this->fields->map(
8✔
59
            fn (Field $field) => ($field->type === $type)
8✔
60
                ? $field->removeModifier($removeModifier)
3✔
61
                : $field,
8✔
62
        );
8✔
63

64
        return new self($fields);
8✔
65
    }
66

67
    public function remove(FieldTypeEnum $type): self
68
    {
69
        $fields = $this->fields->reject(fn (Field $field) => $field->type === $type);
7✔
70

71
        return new self($fields);
7✔
72
    }
73

74
    public function whereType(FieldTypeEnum $type): Collection
75
    {
76
        return $this->fields->where('type', $type);
13✔
77
    }
78

79
    public function whereTypeIn(array $types): Collection
80
    {
81
        return $this->fields->whereIn('type', $types);
6✔
82
    }
83

84
    public function pluck(string $string): Collection
85
    {
86
        return $this->fields->pluck($string);
13✔
87
    }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc