static public function listObjects($filter = null, $return_keys = false, $order_for_mapping = false)
	{
		static $cache = array();
		
		$crunch = $filter . '[' . $return_keys . '[' . $order_for_mapping;
		
		if (isset($cache[$crunch]))
		{
			return $cache[$crunch];
		}
		
		$constants = array();
			
		foreach (get_defined_constants() as $constant => $value)
		{
			if (substr($constant, 0, strlen('QUICKBOOKS_OBJECT_')) == 'QUICKBOOKS_OBJECT_' and 
				substr_count($constant, '_') == 2)
			{
				if (!$return_keys)
				{
					$constant = $value;
				}
				
				if ($filter)
				{
					if (QuickBooks_Utilities::fnmatch($filter, $constant))
					{
						$constants[] = $constant;
					}
				}
				else
				{
					$constants[] = $constant;
				}
			}
		}
			
		if ($order_for_mapping)
		{
			// Sort with the very longest values first, to the shortest values last
			usort($constants, function($a, $b){ return strlen($a) > strlen($b) ? -1 : 1; });
		}
		else
		{
			sort($constants);
		}
			
		$cache[$crunch] = $constants;
			
		return $constants;
	}