Skip to content

Instantly share code, notes, and snippets.

@richardDobron
Created July 14, 2022 15:49
Show Gist options
  • Save richardDobron/74e873c9caef5ce6b98a59ac8fff72e3 to your computer and use it in GitHub Desktop.
Save richardDobron/74e873c9caef5ce6b98a59ac8fff72e3 to your computer and use it in GitHub Desktop.
<?php
class User
{
// ...
public function hasRole(int $roleId): bool
{
return $this->roleId === $roleId;
}
public function isAnalyst(): bool
{
return $this->roleId === 5;
}
}
// ...
$user->hasRole(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment