Passed
Push — main ( df4f12...52ce48 )
by Iain
06:22
created

Team::getCreatedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2020-2024 Iain Cambridge
7
 *
8
 *     This program is free software: you can redistribute it and/or modify
9
 *     it under the terms of the GNU General Public License as published by
10
 *     the Free Software Foundation, either version 3 of the License, or
11
 *     (at your option) any later version.
12
 *
13
 *     This program is distributed in the hope that it will be useful,
14
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 *     GNU General Public License for more details.
17
 *
18
 *     You should have received a copy of the GNU General Public License
19
 *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
namespace Parthenon\User\Entity;
23
24
use Doctrine\Common\Collections\ArrayCollection;
25
use Doctrine\Common\Collections\Collection;
26
27
class Team implements TeamInterface
28
{
29
    protected $id;
30
    protected Collection $members;
31
    private \DateTime $createdAt;
32
    private ?\DateTime $updatedAt;
33
    private ?\DateTime $deletedAt;
34
    private ?string $name = '';
35
    private bool $enabled = true;
36
37
    public function __construct()
38
    {
39
        $this->members = new ArrayCollection();
40
    }
41
42
    public function setId($id)
43
    {
44
        $this->id = $id;
45
    }
46
47
    public function getId()
48
    {
49
        return $this->id;
50
    }
51
52
    /**
53
     * @return MemberInterface[]
54
     */
55
    public function getMembers(): array
56
    {
57
        return $this->members->getValues();
58
    }
59
60
    public function getTeamSize(): int
61
    {
62
        return count($this->members);
63
    }
64
65
    public function hasMember(MemberInterface $member): bool
66
    {
67
        return $this->members->contains($member);
68
    }
69
70
    public function addMember(MemberInterface $member): TeamInterface
71
    {
72
        $this->members->add($member);
73
74
        return $this;
75
    }
76
77
    public function getCreatedAt(): \DateTime
78
    {
79
        return $this->createdAt;
80
    }
81
82
    public function setCreatedAt(\DateTime $createdAt): self
83
    {
84
        $this->createdAt = $createdAt;
85
86
        return $this;
87
    }
88
89
    public function getUpdatedAt(): ?\DateTime
90
    {
91
        return $this->updatedAt;
92
    }
93
94
    public function setUpdatedAt(?\DateTime $updatedAt): self
95
    {
96
        $this->updatedAt = $updatedAt;
97
98
        return $this;
99
    }
100
101
    public function getDeletedAt(): ?\DateTime
102
    {
103
        return $this->deletedAt;
104
    }
105
106
    public function setDeletedAt(?\DateTime $deletedAt): self
107
    {
108
        $this->deletedAt = $deletedAt;
109
110
        return $this;
111
    }
112
113
    public function getName(): ?string
114
    {
115
        return $this->name;
116
    }
117
118
    public function setName(?string $name): void
119
    {
120
        $this->name = $name;
121
    }
122
123
    public function isEnabled(): bool
124
    {
125
        return $this->enabled;
126
    }
127
128
    public function setEnabled(bool $enabled): void
129
    {
130
        $this->enabled = $enabled;
131
    }
132
}
133