/**
* Checks if method requires login and if true,
* checks logged in status.
*
* @param $method
*
* @throws AuthRequired if is not logged in
*/
protected function checkMethodForLoginRequired($method)
{
$isLoggedIn = $this->provider->isLoggedIn();
$methodRequiresLogin = $this->provider->checkMethodRequiresLogin($method);
if ($methodRequiresLogin && !$isLoggedIn) {
$errorMessage = $this->getErrorMethodCallMessage($method, "You must log in before.");
throw new AuthRequired($errorMessage);
}
}