| @@ -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,24 +69,24 @@ discard block | ||
| 69 | 69 |      { | 
| 70 | 70 |          $conn = $env->get('RR_WORKER', static::WORKER_DEFAULT); | 
| 71 | 71 | |
| 72 | -        if ($conn === 'pipes' || empty($conn)) { | |
| 72 | +        if ($conn === 'pipes' || empty($conn)){ | |
| 73 | 73 | $relay = new StreamRelay(STDIN, STDOUT); | 
| 74 | -        } else { | |
| 75 | -            if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { | |
| 74 | +        }else{ | |
| 75 | +            if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){ | |
| 76 | 76 | throw new BootException( | 
| 77 | 77 |                      "Unable to configure Worker connection, invalid DSN given `{$conn}`." | 
| 78 | 78 | ); | 
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | -            if (!in_array($parts[1], ['tcp', 'unix'])) { | |
| 81 | +            if (!in_array($parts[1], ['tcp', 'unix'])){ | |
| 82 | 82 | throw new BootException( | 
| 83 | 83 |                      "Unable to configure Worker connection, invalid DSN given `{$conn}`." | 
| 84 | 84 | ); | 
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | -            if ($parts[1] == 'unix') { | |
| 87 | +            if ($parts[1] == 'unix'){ | |
| 88 | 88 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); | 
| 89 | -            } else { | |
| 89 | +            }else{ | |
| 90 | 90 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); | 
| 91 | 91 | } | 
| 92 | 92 | } | 
| @@ -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,24 +74,32 @@ discard block | ||
| 69 | 74 |      { | 
| 70 | 75 |          $conn = $env->get('RR_WORKER', static::WORKER_DEFAULT); | 
| 71 | 76 | |
| 72 | -        if ($conn === 'pipes' || empty($conn)) { | |
| 77 | + if ($conn === 'pipes' || empty($conn)) | |
| 78 | +        { | |
| 73 | 79 | $relay = new StreamRelay(STDIN, STDOUT); | 
| 74 | -        } else { | |
| 75 | -            if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { | |
| 80 | + } | |
| 81 | + else | |
| 82 | +        { | |
| 83 | +            if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) | |
| 84 | +            { | |
| 76 | 85 | throw new BootException( | 
| 77 | 86 |                      "Unable to configure Worker connection, invalid DSN given `{$conn}`." | 
| 78 | 87 | ); | 
| 79 | 88 | } | 
| 80 | 89 | |
| 81 | -            if (!in_array($parts[1], ['tcp', 'unix'])) { | |
| 90 | + if (!in_array($parts[1], ['tcp', 'unix'])) | |
| 91 | +            { | |
| 82 | 92 | throw new BootException( | 
| 83 | 93 |                      "Unable to configure Worker connection, invalid DSN given `{$conn}`." | 
| 84 | 94 | ); | 
| 85 | 95 | } | 
| 86 | 96 | |
| 87 | -            if ($parts[1] == 'unix') { | |
| 97 | + if ($parts[1] == 'unix') | |
| 98 | +            { | |
| 88 | 99 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); | 
| 89 | -            } else { | |
| 100 | + } | |
| 101 | + else | |
| 102 | +            { | |
| 90 | 103 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); | 
| 91 | 104 | } | 
| 92 | 105 | } |