Browse Source

more methods moved to socket trait

tags/0.8
Paul Rock 7 years ago
parent
commit
059c3fb199
  1. 21
      src/Client.php
  2. 24
      src/SocketTrait.php

21
src/Client.php

@ -429,25 +429,4 @@ class Client implements Interfaces\ClientInterface
return $connected;
}
/**
* Save socket resource to static variable
*
* @param resource $socket
* @return Client
*/
private function setSocket($socket): Client
{
$this->_socket = $socket;
return $this;
}
/**
* Return socket resource if is exist
*
* @return resource
*/
public function getSocket()
{
return $this->_socket;
}
}

24
src/SocketTrait.php

@ -9,6 +9,7 @@ trait SocketTrait
/**
* Initiate socket session
*
* @return void
* @throws \RouterOS\Exceptions\ClientException
* @throws \RouterOS\Exceptions\ConfigException
*/
@ -42,7 +43,7 @@ trait SocketTrait
}
// Save socket to static variable
return $this->setSocket($socket);
$this->setSocket($socket);
}
/**
@ -54,4 +55,25 @@ trait SocketTrait
{
return fclose($this->_socket);
}
/**
* Save socket resource to static variable
*
* @param resource $socket
* @return void
*/
private function setSocket($socket)
{
$this->_socket = $socket;
}
/**
* Return socket resource if is exist
*
* @return resource
*/
public function getSocket()
{
return $this->_socket;
}
}
Loading…
Cancel
Save