__get() public method

Getter
public __get ( string $name ) : mixed
$name string Name
return mixed
示例#1
0
 /**
  * Getter
  * @param  string $name Name
  * @return mixed
  */
 public function __get($name)
 {
     if (in_array($name, ['connected', 'hostReal', 'host', 'port'])) {
         return $this->{$name};
     }
     return parent::__get($name);
 }
示例#2
0
 /**
  * Getter
  * @param  string $name Name
  * @return mixed
  */
 public function __get($name)
 {
     if ($name === 'connected' || $name === 'hostReal' || $name === 'host' || $name === 'port') {
         return $this->{$name};
     }
     return parent::__get($name);
 }