public static function getTeamsCount() { if (self::$_num_teams === null) { if (self::$_teams !== null) { self::$_num_teams = count(self::$_teams); } else { self::$_num_teams = TBGTeamsTable::getTable()->countTeams(); } } return self::$_num_teams; }