/** * constructor. * @param hosts */ private function __construct($hosts) { $result = rmc_connect($hosts); if ($result == -1) { throw new RomaConnectException(); } }
/** * get roma-client instance. * * @param hosts (array) */ public static function getInstance($hosts) { $hosts_string = ""; foreach ($hosts as &$value) { $hosts_string .= $value . ","; } $hosts_string = substr($hosts_string, 0, strlen($hosts_string) - 1); //echo $hosts_string, "<br/>"; $result = rmc_connect($hosts_string); if ($result == 1) { return False; } RomaClient::$romaclient = new RomaClient(); return RomaClient::$romaclient; }