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