<?php
class Langage{
	
	//FIXME const
	public static $java;
	public static $vba;
	
	protected static $languages = array();
	
	protected $ID;
	protected $name;
	protected $avalivableFiles;//String "jar xlsx javadoc" in constructor , stored as a string array
	
	
	public function __construct($ID,$name,$avalivableFiles){
		$this->ID = $ID;
		$this->name = $name;
		$this->avalivableFiles = explode(" ",$avalivableFiles);
		$languages[] = $this;
	}
	
	public function getID(){
		return $this->ID;
	}
	public function getName(){
		return $this->name;
	}
	public function getAvalivableFiles(){
		return $this->avalivableFiles;
	}
	public function isJarAvalivable(){
		return in_array("jar",$this->avalivableFiles);
	}
	public function isJavaAvalivable(){
		return in_array("java",$this->avalivableFiles);
	}
	public function isJavadocAvalivable(){
		return in_array("javadoc",$this->avalivableFiles);
	}
	public function isXlsmAvalivable(){
		return in_array("xlsm",$this->avalivableFiles);
	}
	public function isVbAvalivable(){
		return in_array("vb",$this->avalivableFiles);
	}
	
	public static function getFromID($ID){
		foreach(self::$languages AS $language){
			if($language->getID() == $ID)
				return $language;
		}
		return NULL;
	}
	
}
Langage::$java = new Langage(0, "Java", "jar java javadoc");
Langage::$vba = new Langage(1, "VBA", "xlsm vb");
