if ($user->isModerator()) {
$user->updateStatus(self::SUPPORT);
$a = $this->get($user, 'status', []);
echo 'Вы модератор';
}
elseif ($user->isSupport()) {
$user->updateStatus(self::MODERATOR);
$a = $this->get($user, 'id', []);
echo 'Вы поддержка';
}
$options = [
[
"condition" => isModerator(),
"execute" => function () {
echo 'isModerator';
}
],
[
"condition" => isSupport(),
"execute" => function () {
echo 'isSupport';
}
],
];
array_walk(array_filter($options, function ($item) {
return $item["condition"];
}), function ($item) {
$item["execute"]();
});