QuickBooks/IPP/IntuitAnywhere.php
public function expiry($app_username, $app_tenant, $within = 2592000)
	{
		$lifetime = 15552000;

		if ($arr = $this->_driver->oauthLoad($this->_key, $app_username, $app_tenant) and 
			strlen($arr['oauth_access_token']) > 0 and 
			strlen($arr['oauth_access_token_secret']) > 0)
		{
			$expires = $lifetime + strtotime($arr['access_datetime']);

			$diff = $expires - time();

			if ($diff < 0)
			{
				// Already expired
				return QuickBooks_IPP_IntuitAnywhere::EXPIRY_EXPIRED;
			}
			else if ($diff < $within)
			{
				return QuickBooks_IPP_IntuitAnywhere::EXPIRY_SOON;
			}

			return QuickBooks_IPP_IntuitAnywhere::EXPIRY_NOTYET;
		}

		return QuickBooks_IPP_IntuitAnywhere::EXPIRY_UNKNOWN;
	}
public function expiry($app_username, $app_tenant, $within = 2592000)
	{
		$lifetime = 15552000;

		if ($arr = $this->_driver->oauthLoad($this->_key, $app_username, $app_tenant) and 
			strlen($arr['oauth_access_token']) > 0 and 
			strlen($arr['oauth_access_token_secret']) > 0)
		{
			$expires = $lifetime + strtotime($arr['access_datetime']);

			$diff = $expires - time();

			if ($diff < 0)
			{
				// Already expired
				return QuickBooks_IPP_IntuitAnywhere::EXPIRY_EXPIRED;
			}
			else if ($diff < $within)
			{
				return QuickBooks_IPP_IntuitAnywhere::EXPIRY_SOON;
			}

			return QuickBooks_IPP_IntuitAnywhere::EXPIRY_NOTYET;
		}

		return QuickBooks_IPP_IntuitAnywhere::EXPIRY_UNKNOWN;
	}
Check whether a connection is due for refresh/reconnect

@param string $app_username
@param string $app_tenant
@param integer $within
@return One of the QuickBooks_IPP_IntuitAnywhere::EXPIRY_* constants