syntax & bug fixes (first startable version)
[PHP-P10.git] / Uplink / P10_Server.class.php
index f36bbeae3cc1c4092e251e0301f5e88ee3603be4..1b65ed95e79e2731ca448ee04dc14c289a5270ff 100644 (file)
 class P10_Server {
        private static $static_servers = array();
        
-       public static getServerByNum($numeric) {
+       public static function getServerByNum($numeric) {
                if(array_key_exists($numeric, self::$static_servers)) {
                        return self::$static_servers[$numeric];
                }
                return NULL;
        }
        
+       public static function getServerByName($name) {
+               $name = strtolower($name);
+               foreach(self::$static_servers as $server) {
+                       if(strtolower($server->getName()) == $name) {
+                               return $server;
+                       }
+               }
+               return NULL;
+       }
+       
        
        private $name;
        private $numeric;