QuickBooks/IPP.php
public function context($ticket = null, $token = null, $check_if_valid = true)
	{
		$Context = null;

		if ($this->_authmode == QuickBooks_IPP::AUTHMODE_OAUTH)
		{
			$Context = new QuickBooks_IPP_Context($this, null, $token);

			// @todo Support for checking if it's valid or not
		}
		else
		{
			if (is_null($ticket))
			{
				$ticket = QuickBooks_IPP_Federator::getCookie();
			}

			$Context = new QuickBooks_IPP_Context($this, $ticket, $token);

			//print('check if valid [' . $check_if_valid . ']');

			if ($check_if_valid)
			{
				// Now, let's check to make sure the context is valid
				$User = $this->getUserInfo($Context);

				if (!$User or
					!is_object($User) or
					$User->isAnonymous())
				{
					return null;
				}
			}
		}

		//print_r($Context);

		return $Context;
	}
public function context($ticket = null, $token = null, $check_if_valid = true)
	{
		$Context = null;

		if ($this->_authmode == QuickBooks_IPP::AUTHMODE_OAUTH)
		{
			$Context = new QuickBooks_IPP_Context($this, null, $token);

			// @todo Support for checking if it's valid or not
		}
		else
		{
			if (is_null($ticket))
			{
				$ticket = QuickBooks_IPP_Federator::getCookie();
			}

			$Context = new QuickBooks_IPP_Context($this, $ticket, $token);

			//print('check if valid [' . $check_if_valid . ']');

			if ($check_if_valid)
			{
				// Now, let's check to make sure the context is valid
				$User = $this->getUserInfo($Context);

				if (!$User or
					!is_object($User) or
					$User->isAnonymous())
				{
					return null;
				}
			}
		}

		//print_r($Context);

		return $Context;
	}
Create a Context object (used for session management) for a given ticket and token