Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Update NanoIPC.php
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRow committed Jun 28, 2020
1 parent fcd2d1d commit f75f1b4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/NanoIPC.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class NanoIPC
private $transportType;
private $transport;
private $transportPreamble;
private $transportPath;
private $transportPathToSocket;
private $transportHostname;
private $transportPort;
private $authType;
Expand All @@ -39,13 +39,13 @@ public function __construct(string $transport_type, array $params)
// # Unix domain Socket

if ($transport_type == 'unix_domain_socket') {
if (!isset($params['path']) || !is_string($params['path'])) {
throw new NanoIPCException("Invalid transport path: " . $params['path']);
if (!isset($params['path_to_socket']) || !is_string($params['path_to_socket'])) {
throw new NanoIPCException("Invalid path to socket: " . $params['path_to_socket']);
}

$this->transportPath = $params['path'];
$this->transportPathToSocket = $params['path_to_socket'];
$this->transport = stream_socket_client(
"unix://{$this->transportPath}",
"unix://{$this->transportPathToSocket}",
$this->errorCode,
$this->error
);
Expand All @@ -58,10 +58,10 @@ public function __construct(string $transport_type, array $params)

} elseif ($transport_type == 'TCP') {
if (!isset($params['hostname']) || !is_string($params['hostname'])) {
throw new NanoIPCException("Invalid transport hostname: " . $params['hostname']);
throw new NanoIPCException("Invalid hostname: " . $params['hostname']);
}
if (!isset($params['port']) || !is_int((int) $params['port'])) {
throw new NanoIPCException("Invalid transport port: " . $params['port']);
throw new NanoIPCException("Invalid port: " . $params['port']);
}

$this->transportHostname = $params['hostname'];
Expand Down

0 comments on commit f75f1b4

Please sign in to comment.