cvs: pear /Net_GameServerQuery/GameServerQuery GameData.php

From: Date: Tue, 18 Jan 2005 04:46:46 +0000
Subject: cvs: pear /Net_GameServerQuery/GameServerQuery GameData.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-28654@lists.php.net to get a copy of this message
aidan Mon Jan 17 23:46:46 2005 EDT Added files: /pear/Net_GameServerQuery/GameServerQuery GameData.php Log: This replaces the Config class. It acts as an interface to get data from the game data file (currently Games.php). http://cvs.php.net/co.php/pear/Net_GameServerQuery/GameServerQuery/GameData.php?r=1.1&p=1 Index: pear/Net_GameServerQuery/GameServerQuery/GameData.php +++ pear/Net_GameServerQuery/GameServerQuery/GameData.php <?php // +----------------------------------------------------------------------+ // | PHP version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Aidan Lister <aidan@php.net> | // | Tom Buskens <ortega@php.net> | // +----------------------------------------------------------------------+ // // $Id: GameData.php,v 1.1 2005/01/18 04:46:46 aidan Exp $ /** * API for accessing stored protocol and game information * * Provides an abstraction for accessing the stored protocol data and * game information. * * @category Net * @package Net_GameServerQuery * @author Aidan Lister <aidan@php.net> * @author Tom Buskens <ortega@php.net> * @version $Revision: 1.1 $ */ class Net_GameServerQuery_GameData { /** * An array of all game information * * @var array */ private static $_games; /** * An array of all packet information * * @var array */ private static $_packets; /** * An array of all normal information * * @var array */ private static $_normals; /** * Constructor */ public function __construct() { // Load the games information require NET_GAMESERVERQUERY_BASE . 'Games.php'; // Store it $this->_games = $games; $this->_packets = $packets; $this->_normals = $normals; } /** * Test if game is registered * * @param string $game The game * @return string TRUE if the game is valid else FALSE */ public function is_game($game) { if (isset($this->_games[$game])) { return true; } return false; } /** * Test if protocol is registered * * @param string $protocol The protocol * @return bool TRUE if the protocol is valid else FALSE */ public function is_protocol($protocol) { if (isset($this->_games[$game])) { return true; } return false; } /** * Return packet used by a certain protocol * * @param string $protocol The protocol * @param string $type The packet type * @return array The packet used */ public function getProtocolPacket($protocol, $type) { return $this->_packets[$protocol][$type]; } /** * Return normal keys * * @param string The protocol * @return array The normals */ public function getProtocolNormals($protocol = 0) { return $this->_normals[$protocol]; } /** * Return protocol used by a certain game * * @return string The game used * @param string $game The game */ public function getGameProtocol($game) { return $this->_games[$game]['protocol']; } /** * Return default query port used by a certain game * * @return string The default query port used * @param string $game The game */ public function getGamePort($game) { return $this->_games[$game]['queryport']; } } ?>

« previous php.pear.cvs (#28654) next »