seregazhuk\PinterestBot\Api\Providers\Provider::checkMethodRequiresLogin PHP Method

checkMethodRequiresLogin() public method

public checkMethodRequiresLogin ( string $method ) : boolean
$method string
return boolean
    public function checkMethodRequiresLogin($method)
    {
        return in_array($method, $this->loginRequiredFor);
    }

Usage Example

 /**
  * 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);
     }
 }