@@ -40,21 +40,26 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
| 42 | 42 | |
| 43 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
| 43 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
| 44 | + { |
|
| 44 | 45 | throw new BootException( |
| 45 | 46 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
| 46 | 47 | ); |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
| 50 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
| 51 | + { |
|
| 50 | 52 | throw new BootException( |
| 51 | 53 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
| 52 | 54 | ); |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | - if ($parts[1] == 'unix') { |
|
| 57 | + if ($parts[1] == 'unix') |
|
| 58 | + { |
|
| 56 | 59 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
| 57 | - } else { |
|
| 60 | + } |
|
| 61 | + else |
|
| 62 | + { |
|
| 58 | 63 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
| 59 | 64 | } |
| 60 | 65 | |
@@ -69,25 +74,31 @@ discard block |
||
| 69 | 74 | { |
| 70 | 75 | $conn = $env->get('RR_RELAY', static::WORKER_DEFAULT); |
| 71 | 76 | |
| 72 | - if ($conn === 'pipes' || empty($conn)) { |
|
| 77 | + if ($conn === 'pipes' || empty($conn)) |
|
| 78 | + { |
|
| 73 | 79 | return new Worker(new StreamRelay(STDIN, STDOUT)); |
| 74 | 80 | } |
| 75 | 81 | |
| 76 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
| 82 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
| 83 | + { |
|
| 77 | 84 | throw new BootException( |
| 78 | 85 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
| 79 | 86 | ); |
| 80 | 87 | } |
| 81 | 88 | |
| 82 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
| 89 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
| 90 | + { |
|
| 83 | 91 | throw new BootException( |
| 84 | 92 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
| 85 | 93 | ); |
| 86 | 94 | } |
| 87 | 95 | |
| 88 | - if ($parts[1] == 'unix') { |
|
| 96 | + if ($parts[1] == 'unix') |
|
| 97 | + { |
|
| 89 | 98 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
| 90 | - } else { |
|
| 99 | + } |
|
| 100 | + else |
|
| 101 | + { |
|
| 91 | 102 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
| 92 | 103 | } |
| 93 | 104 | |