<?php

/**
 * 
 * SWX Cards API by Aral Balkan.
 * Implements Ted Patrick's Cards API in SWX.
 * 
 * You can call this API using SWX, Amfphp, JSON and XML-RPC.
 * 
 * @author	Aral Balkan
 * @copyright	2007 Aral Balkan. All Rights Reserved. 
 * @link 	http://aralbalkan.com
 * @link 	http://swxformat.org
 * @link    mailto://aral@aralbalkan.com
 * 
**/
require_once("../BaseService.php");

class Cards extends BaseService
{
	/**
	 * Shuffles cards.
	 * 
	 * @param	(optional) Number of decks to shuffle (defaults to 1)
	 * @param 	(optional) Number of jokers to shuffle in (defaults to 0)
	 * 
	 * @return Shuffled deck and timestamp.
	 * @author Aral Balkan
	 **/
	function shuffle($numDecks = 1, $numJokers = 0)
	{
		$url = "http://onflex.org/api/games/cards/shuffle/1/$numDecks/$numJokers";
		
		$result = $this->_call($url);
		
		$shuffledDeck = explode('|', $result);
		$timeStamp = array_shift($shuffledDeck);
		
		return (array('timeStamp' => $timeStamp, 'deck' => $shuffledDeck));
	}
}

?>