Source for file Team.php

Documentation is available at Team.php

  1. <?php
  2. /**
  3.  * Defines Team class.
  4.  *
  5.  * @package recAnalyst
  6.  * @version $Id: Team.php 22 2009-05-11 12:50:44Z biegleux $
  7.  * @author biegleux <biegleux[at]gmail[dot]com>
  8.  * @copyright copyright (c) 2008-2009 biegleux
  9.  * @license http://www.opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
  10.  * @link http://recanalyst.sourceforge.net/
  11.  * @filesource
  12.  */
  13.  
  14. /**
  15.  * Class Team.
  16.  *
  17.  * Team implements a team in the game.
  18.  *
  19.  * @package recAnalyst
  20.  */
  21. class Team extends PlayerList
  22. {
  23.     /**
  24.      * Team's index.
  25.      *
  26.      * @var int 
  27.      */
  28.     private $index;
  29.  
  30.     /**
  31.      * Constructor.
  32.      *
  33.      */
  34.     public function __construct ()
  35.     {
  36.         parent::__construct();
  37.         $this->index = -1;
  38.     }
  39.  
  40.     /**
  41.      * Adds a player to the team.
  42.      *
  43.      * @param Player $player the player we wish to add
  44.      */
  45.     public function addPlayer (Player $player)
  46.     {
  47.         parent::addPlayer ($player);
  48.  
  49.         if ($this->index == -1)
  50.         {
  51.             $this->index $player->team;
  52.         }
  53.     }
  54.  
  55.     /**
  56.      * Returns an index of the team.
  57.      *
  58.      * @return int team's index
  59.      */
  60.     public function getIndex ()
  61.     {
  62.         return $this->index;
  63.     }
  64. }
  65. ?>

Documentation generated on Mon, 11 May 2009 16:43:53 +0200 by phpDocumentor 1.4.1