<commit_before><?php
/**
 * Contains information on the ships in the game.
 *
 * @copyright   2012 <NAME> <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @since       14/09/2012
 */
class Core_Ship
{
	/**
	 * The ships that are available.
	 * 
	 * <code>
	 * array(
	 *     'ship_id'             => 123,
	 *     'ship_order_of_fire'  => 1,
	 *     'ship_name'           => 'Le Ship',
	 *     'ship_class'          => 1,
	 *     'ship_target'         => 2,
	 *     'ship_life'           => 10,
	 *     'ship_attack'         => 1,
	 *     'ship_primary_cost'   => 100,
	 *     'ship_secondary_cost' => 25
	 * )
	 * </code>
	 * 
	 * @access public
	 * @var array
	 * @static
	 */
	public static $_ship;

	/**
	 * Returns the ship information, or sets them if it doesn't exist.
	 *
	 * @access public
	 * @return array
	 */
	public function getInstance() {
		// Have we already got the ship information?
		if (! self::$_ship) {
			// No, go and get them
			self::setShip();
		}

		// Return the ship information
		return self::$_ship;
	}

	/**
	 * Set the ships that are stored in the database.
	 * 
	 * @access public
	 */
	public function setShip() {
		// Get the database connection
		$database  = Core_Database::getInstance();
		// Prepare the SQL
		$statement = $database->prepare("
			SELECT s.ship_id, s.ship_order_of_fire, s.ship_name, s.ship_type, s.ship_class, s.ship_target, s.ship_life, s.ship_attack, s.ship_primary_cost, s.ship_secondary_cost
			FROM   `ship` s
		");
		// Execute the query
		$statement->execute();

		// Did we find any ships?
		while ($ship = $statement->fetch()) {
			self::$_ship[$ship['ship_order_of_fire']] = $ship;
		}
	}
}<commit_msg>Ship class is now a bit more sane. Returns ships with ship ID as index, and ordered by order of file.<commit_after><?php
/**
 * Contains information on the ships in the game.
 *
 * @copyright   2012 <NAME> <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @since       14/09/2012
 */
class Core_Ship
{
	/**
	 * The ships that are available.
	 * 
	 * <code>
	 * array(
	 *     'ship_id'             => 123,
	 *     'ship_order_of_fire'  => 1,
	 *     'ship_name'           => 'Le Ship',
	 *     'ship_class'          => 1,
	 *     'ship_target'         => 2,
	 *     'ship_life'           => 10,
	 *     'ship_attack'         => 1,
	 *     'ship_primary_cost'   => 100,
	 *     'ship_secondary_cost' => 25
	 * )
	 * </code>
	 * 
	 * @access public
	 * @var array
	 * @static
	 */
	public static $_ship;

	/**
	 * Returns the ship information, or sets them if it doesn't exist.
	 *
	 * @access public
	 * @return array
	 */
	public function getInstance() {
		// Have we already got the ship information?
		if (! self::$_ship) {
			// No, go and get them
			self::setShip();
		}

		// Return the ship information
		return self::$_ship;
	}

	/**
	 * Set the ships that are stored in the database.
	 * 
	 * @access public
	 */
	public function setShip() {
		// Get the database connection
		$database  = Core_Database::getInstance();
		// Prepare the SQL
		$statement = $database->prepare("
			SELECT   s.ship_id, s.ship_order_of_fire, s.ship_name, s.ship_type, s.ship_class, s.ship_target, s.ship_life, s.ship_attack, s.ship_primary_cost, s.ship_secondary_cost
			FROM     `ship` s
			ORDER BY s.ship_order_of_fire ASC
		");
		// Execute the query
		$statement->execute();

		// Did we find any ships?
		while ($ship = $statement->fetch()) {
			self::$_ship[$ship['ship_id']] = $ship;
		}
	}
}
{'fraction_non_alphanumeric': 0.14716106604866744, 'fraction_numerical': 0.015063731170336037, 'mean_word_length': 2.36222005842259, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '481784', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1147, 'n_words': 318}