usersList; } public function getUsersRequests(): ?array { return $this->usersRequests; } public function addUsersRequests(RelationshipRequest $request): void { $this->usersRequests [] = $request; } public function removeRequest(RelationshipRequest $req): bool { $key = array_search($req, $this->usersRequests); if ($key !== false) { array_splice($this->usersRequests, $key, 1); return true; } return false; } public abstract function CheckAdd(User $user) : bool; public function addUser(User $user): bool { if($this->CheckAdd($user)){ array_push($this->usersList, $user); return true; } return false; } /** * @param User $user * @return bool */ public function removeUser(User $user): bool { if($this->CheckAdd($user)){ $key = array_search($user, $this->usersList); if ($key !== false) { array_splice($this->usersList, $key, 1); return true; } } return false; } public function addTraining(Training $training) { $this->trainingList [] = $training; return true; } public function getTrainingsList(): array { return $this->trainingList; } } ?>