<?php
/**
* Simple example usage
*
* @package TypesafeEnum
* @author Fabian Schmengler <fschmengler@sgh-it.eu>
* @copyright © 2010 SGH informationstechnologie UG
* @license BSD
* @link http://creativecommons.org/licenses/BSD/
* @version 1.1
*/
require_once realpath(dirname(__FILE__) . '/../typesafeenum.lib.php');
Enum::define_once('Suit', 'CLUBS', 'DIAMONTS', 'HEARTS', 'SPADES');
echo '<pre>';
echo "\n<b>Suit::CLUBS():</b>\n";
var_dump(Suit::CLUBS());
echo "\n<b>Suit::DIAMONTS():</b>\n";
var_dump(Suit::DIAMONTS());
echo "\n<b>Enum::valuesOf('Suit'):</b>\n";
var_dump(Enum::valuesOf('Suit'));
echo "\n<b>testSuit(Suit::SPADES()):</b>\n";
testSuit(Suit::SPADES());
echo '</pre>';
function testSuit(Suit $suit)
{
echo " \$suit to string: $suit\n";
echo " \$suit===Suit::SPADES(): ";
var_export($suit===Suit::SPADES());
}
?>
|