1 | <?php |
||
28 | trait Tournament |
||
29 | { |
||
30 | use TimestampableEntity; |
||
31 | use NameEntity; |
||
32 | |||
33 | //<editor-fold desc="Fields"> |
||
34 | /** |
||
35 | * @ORM\Column(type="string") |
||
36 | * @var string |
||
37 | */ |
||
38 | private $userIdentifier; |
||
39 | |||
40 | /** |
||
41 | * @ORM\Column(type="string") |
||
42 | * @var string |
||
43 | */ |
||
44 | private $tournamentListId; |
||
45 | /** |
||
46 | * @ORM\ManyToOne(targetEntity="\Tfboe\FmLib\Entity\User") |
||
47 | * @var User |
||
48 | */ |
||
49 | private $creator; |
||
50 | /** |
||
51 | * @ORM\OneToMany(targetEntity="\Tfboe\FmLib\Entity\CompetitionInterface", mappedBy="tournament",indexBy="name") |
||
52 | * @var Collection|CompetitionInterface[] |
||
53 | */ |
||
54 | private $competitions; |
||
55 | //</editor-fold desc="Fields"> |
||
56 | |||
57 | //<editor-fold desc="Public Methods"> |
||
58 | /** |
||
59 | * @inheritDoc |
||
60 | */ |
||
61 | public function getChildren(): Collection |
||
65 | |||
66 | /** |
||
67 | * @return CompetitionInterface[]|Collection |
||
68 | */ |
||
69 | public function getCompetitions() |
||
73 | |||
74 | /** |
||
75 | * @return User |
||
76 | */ |
||
77 | public function getCreator(): User |
||
81 | |||
82 | /** |
||
83 | * @inheritDoc |
||
84 | */ |
||
85 | public function getLevel(): int |
||
89 | |||
90 | /** |
||
91 | * @inheritDoc |
||
92 | */ |
||
93 | public function getLocalIdentifier() |
||
97 | |||
98 | /** |
||
99 | * @inheritDoc |
||
100 | */ |
||
101 | public function getParent(): ?TournamentHierarchyInterface |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getTournamentListId(): string |
||
113 | |||
114 | /** |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getUserIdentifier(): string |
||
121 | |||
122 | /** |
||
123 | * Tournament constructor. |
||
124 | */ |
||
125 | public function init() |
||
130 | |||
131 | /** |
||
132 | * @param User $creator |
||
133 | * @return TournamentInterface|Tournament |
||
134 | */ |
||
135 | public function setCreator(User $creator) |
||
140 | |||
141 | /** |
||
142 | * @param string $tournamentListId |
||
143 | * @return TournamentInterface|Tournament |
||
144 | */ |
||
145 | public function setTournamentListId(string $tournamentListId) |
||
150 | |||
151 | /** |
||
152 | * @param string $userIdentifier |
||
153 | * @return TournamentInterface|Tournament |
||
154 | */ |
||
155 | public function setUserIdentifier(string $userIdentifier) |
||
160 | //</editor-fold desc="Public Methods"> |
||
161 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.