isAnonymous
Learn how to check whether the token is anonymous.
This method reports whether the token represents an anonymous visitor. The token is anonymous until you identify the visitor.
Signature
This method has the following signature:
public function isAnonymous(): boolThis method returns true when the token has no subject, and false otherwise.
Example
Here is a basic example of how to use this method:
<?phpuse Croct\Plug\Croct;
$croct = Croct::fromDotenv();$token = $croct->getUserToken();
if (!$token->isAnonymous()) { $userId = $token->getSubject();}