Instagram\Instagram::blockUser PHP Method

blockUser() public method

Block User
public blockUser ( string | User $userId ) : BlockFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to Block
return Instagram\API\Response\BlockFriendshipResponse
    public function blockUser($userId)
    {
        if (!$this->isLoggedIn()) {
            throw new InstagramException("You must be logged in to call blockUser().");
        }
        if ($userId instanceof User) {
            $userId = $userId->getPk();
        }
        $request = new BlockFriendshipRequest($this, $userId);
        $response = $request->execute();
        if (!$response->isOk()) {
            throw new InstagramException(sprintf("Failed to blockUser: [%s] %s", $response->getStatus(), $response->getMessage()));
        }
        return $response;
    }