1 | <?php |
||
28 | trait Tournament |
||
29 | { |
||
30 | use TimestampableEntity; |
||
31 | use NameEntity; |
||
32 | |||
33 | //<editor-fold desc="Fields"> |
||
34 | |||
35 | /** |
||
36 | * @ORM\Column(type="string") |
||
37 | * @var string |
||
38 | */ |
||
39 | private $tournamentListId; |
||
40 | /** |
||
41 | * @ORM\ManyToOne(targetEntity="\Tfboe\FmLib\Entity\UserInterface") |
||
42 | * @var UserInterface |
||
43 | */ |
||
44 | private $creator; |
||
45 | /** |
||
46 | * @ORM\OneToMany(targetEntity="\Tfboe\FmLib\Entity\CompetitionInterface", mappedBy="tournament",indexBy="name") |
||
47 | * @var Collection|CompetitionInterface[] |
||
48 | */ |
||
49 | private $competitions; |
||
50 | //</editor-fold desc="Fields"> |
||
51 | |||
52 | //<editor-fold desc="Public Methods"> |
||
53 | /** |
||
54 | * @inheritDoc |
||
55 | */ |
||
56 | public function getChildren(): Collection |
||
60 | |||
61 | /** |
||
62 | * @return CompetitionInterface[]|Collection |
||
63 | */ |
||
64 | public function getCompetitions() |
||
68 | |||
69 | /** |
||
70 | * @return UserInterface |
||
71 | */ |
||
72 | public function getCreator(): UserInterface |
||
76 | |||
77 | /** |
||
78 | * @inheritDoc |
||
79 | */ |
||
80 | public function getLevel(): int |
||
84 | |||
85 | /** |
||
86 | * @inheritDoc |
||
87 | */ |
||
88 | public function getLocalIdentifier() |
||
92 | |||
93 | /** |
||
94 | * @inheritDoc |
||
95 | */ |
||
96 | public function getParent(): ?TournamentHierarchyInterface |
||
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getTournamentListId(): string |
||
108 | |||
109 | /** |
||
110 | * Tournament constructor. |
||
111 | */ |
||
112 | protected final function init() |
||
117 | |||
118 | /** |
||
119 | * @param UserInterface $creator |
||
120 | * @return TournamentInterface|Tournament |
||
121 | */ |
||
122 | public function setCreator(UserInterface $creator) |
||
127 | |||
128 | /** |
||
129 | * @param string $tournamentListId |
||
130 | * @return TournamentInterface|Tournament |
||
131 | */ |
||
132 | public function setTournamentListId(string $tournamentListId) |
||
137 | //</editor-fold desc="Public Methods"> |
||
138 | } |
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.