Skip to content

Commit

Permalink
1.disable some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 25, 2016
1 parent 44754a0 commit abb58a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/dubboClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class dubboClient{
protected $register;
static $protocols;
static $protocols = array();

public function __construct($options=array())
{
Expand Down Expand Up @@ -46,7 +46,7 @@ public function getService($serviceName, $version, $group, $protocol = "jsonrpc"
*/
private function makeInvokerByProtocol($protocol){

if(array_key_exists(self::$protocols,$protocol)){
if(array_key_exists($protocol,self::$protocols)){
return self::$protocols[$protocol];
}

Expand Down
6 changes: 3 additions & 3 deletions src/invok/cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public static function getInstance(){

public function addProvider($invokerDesc,$host,$schema){
$desc = $invokerDesc->toString();
$this->providerMap[$desc][] = $host;
self::$providerMap[$desc][] = $host;
}


public function getProvider($invokerDesc){
$desc = $invokerDesc->toString();
$key = array_rand($this->providerMap[$desc]);
return $this->providerMap[$desc][$key];
$key = array_rand(self::$providerMap[$desc]);
return self::$providerMap[$desc][$key];
}

public function getProviders(){
Expand Down
7 changes: 3 additions & 4 deletions src/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,14 @@ public function zkinfo($invokerDesc){
*/
private function achieveRegisterIp(){
try {
$registerIp = gethostbyaddr($_SERVER['SERVER_ADDR']);
if($_SERVER['SERVER_ADDR'])
$registerIp = gethostbyaddr($_SERVER['SERVER_ADDR']);
if (empty($registerIp)) {
if (substr(strtolower(PHP_OS), 0, 3) != 'win') {
$ss = exec('/sbin/ifconfig | sed -n \'s/^ *.*addr:\\([0-9.]\\{7,\\}\\) .*$/\\1/p\'', $arr);
$registerIp = $arr[0];
}else{
/** @TODO
* @ implement the windows ip
**/
// TODO: implement the windows ip
}
}
}catch (\Exception $e){
Expand Down

0 comments on commit abb58a9

Please sign in to comment.