Permalink
Browse files

Merge pull request #226 from tarasfrompir/master

Update Yeelight.class.php
  • Loading branch information...
T-REX-XP committed Aug 1, 2018
2 parents 1204394 + 3fc4c3c commit b8c0da1a592374d62d10f2d98b65c0997b93137c
Showing with 4 additions and 4 deletions.
  1. +4 −4 modules/ssdp_finder/upnp/vendor/jalder/upnp/src/Yeelight/Yeelight.class.php
@@ -3,8 +3,8 @@ class Yeelight {
private $jobs = array();
public function __construct($controladress) {
$this->ip = getIp($controladress);
$this->port = getPort($controladress);
$this->ip = $this->getIp($controladress, false);
$this->port = $this->getPort($controladress);
if (!$this->verifyConnection()) throw new Exception("Failed connecting to Yeelight device.");
}
@@ -52,7 +52,7 @@ public function disconnect() {
fclose($this->fp);
}
function getIp($baseUrl,$withPort) {
public function getIp($baseUrl,$withPort) {
if( !empty($baseUrl) ){
$parsed_url = parse_url($baseUrl);
if($withPort ==true){
@@ -64,7 +64,7 @@ function getIp($baseUrl,$withPort) {
return $baseUrl;
}
function getPort($address){
public function getPort($address){
$baseUrl="";
if( !empty($address) ){
$parsed_url = parse_url($address);

0 comments on commit b8c0da1

Please sign in to comment.