@@ -129,6 +129,6 @@ |
||
| 129 | 129 | $processor->setData($query); |
| 130 | 130 | } |
| 131 | 131 | $response = $processor->getResponse(); |
| 132 | - return $response ? stream_get_contents($response) : '' ; |
|
| 132 | + return $response ? stream_get_contents($response) : ''; |
|
| 133 | 133 | } |
| 134 | 134 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $lib = $this->prepareQuerySimple(); |
| 22 | 22 | $lib->setHost('somewhere.example'); |
| 23 | 23 | $lib->setPort(80); |
| 24 | - $lib->addValues(['foo' => 'bar', 'abc' => 'def',]); |
|
| 24 | + $lib->addValues(['foo' => 'bar', 'abc' => 'def', ]); |
|
| 25 | 25 | |
| 26 | 26 | $this->assertEquals("GET /example HTTP/1.1\r\nHost: somewhere.example\r\nContent-Length: 25\r\n\r\n" |
| 27 | 27 | . '{"foo":"bar","abc":"def"}' |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $lib = $this->prepareQuerySimple(); |
| 30 | 30 | $lib->setHost('somewhere.example'); |
| 31 | 31 | $lib->setPort(80); |
| 32 | - $lib->addValues(['foo' => 'bar', 'abc' => 'def',]); |
|
| 32 | + $lib->addValues(['foo' => 'bar', 'abc' => 'def', ]); |
|
| 33 | 33 | |
| 34 | 34 | $this->assertEquals("GET /example HTTP/1.1\r\nHost: somewhere.example\r\nContent-Length: 15\r\n\r\n" |
| 35 | 35 | . 'foo=bar&abc=def' |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | 0x00, 0x10, # data_length |
| 150 | 150 | 0x00, 0x00, 0x00, 0x00, # position |
| 151 | 151 | 'Testing error 1', 0x00, # content |
| 152 | - # extra data - empty |
|
| 152 | + # extra data - empty |
|
| 153 | 153 | ]); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | # content... |
| 53 | 53 | 0x12, 0x34, 0x56, 0x78, # time |
| 54 | 54 | 0x00, 0x00, 0x04, 0x00, # size |
| 55 | - 0x01, # type |
|
| 55 | + 0x01, # type |
|
| 56 | 56 | 'foo-bar-baz.txt', 0x00, # filename - "foo-bar-baz.txt\0" |
| 57 | 57 | 0x00, 0x00, 0x00, # padding 28 |
| 58 | 58 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | 0x03, 0x04, # sequence |
| 247 | 247 | 0x00, 0x09, # data_length |
| 248 | 248 | 0x00, 0x00, 0x00, 0x00, # position |
| 249 | - 0x5E, 0x0B, 0xE1, 0x01, 0x00, 0x23, 0x44, 0x00, 0b00100000, # file stats - 2020-01-01T00:00:01+00:00, 2311168 B file |
|
| 249 | + 0x5E, 0x0B, 0xE1, 0x01, 0x00, 0x23, 0x44, 0x00, 0b00100000, # file stats - 2020-01-01T00:00:01+00:00, 2311168 B file |
|
| 250 | 250 | # no extra data |
| 251 | 251 | ]); |
| 252 | 252 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | error_reporting(~E_WARNING); |
| 6 | 6 | |
| 7 | 7 | //Create a UDP socket |
| 8 | -if(!($sock = socket_create(AF_INET, SOCK_DGRAM, 0))) |
|
| 8 | +if (!($sock = socket_create(AF_INET, SOCK_DGRAM, 0))) |
|
| 9 | 9 | { |
| 10 | 10 | $errorcode = socket_last_error(); |
| 11 | 11 | $errormsg = socket_strerror($errorcode); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | echo "Socket created \n"; |
| 17 | 17 | |
| 18 | 18 | // Bind the source address |
| 19 | -if( !socket_bind($sock, "0.0.0.0" , 9999) ) |
|
| 19 | +if (!socket_bind($sock, "0.0.0.0", 9999)) |
|
| 20 | 20 | { |
| 21 | 21 | $errorcode = socket_last_error(); |
| 22 | 22 | $errormsg = socket_strerror($errorcode); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | echo "Socket bind OK \n"; |
| 28 | 28 | |
| 29 | 29 | //Do some communication, this loop can handle multiple clients |
| 30 | -while(1) |
|
| 30 | +while (1) |
|
| 31 | 31 | { |
| 32 | 32 | echo "Waiting for data ... \n"; |
| 33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | echo "$remote_ip : $remote_port -- " . $buf; |
| 37 | 37 | |
| 38 | 38 | //Send back the data to the client |
| 39 | - socket_sendto($sock, "OK " . $buf , 100 , 0 , $remote_ip , $remote_port); |
|
| 39 | + socket_sendto($sock, "OK " . $buf, 100, 0, $remote_ip, $remote_port); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | socket_close($sock); |
| 43 | 43 | \ No newline at end of file |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $this->remoteResponse = null; |
| 49 | 49 | $reply = null; |
| 50 | - $result = socket_recv($filePointer, $reply , static::PART_SPLIT , MSG_WAITALL); |
|
| 50 | + $result = socket_recv($filePointer, $reply, static::PART_SPLIT, MSG_WAITALL); |
|
| 51 | 51 | if (false === $result) { // because could return size 0 bytes |
| 52 | 52 | $errorCode = socket_last_error(); |
| 53 | 53 | $errorMessage = socket_strerror($errorCode); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $this->lang = $lang; |
| 35 | 35 | $pointer = empty($contextOptions) |
| 36 | 36 | ? ($long ? new RemoteRequest\Sockets\PfSocket($lang) : new RemoteRequest\Sockets\FSocket($lang)) |
| 37 | - : (new RemoteRequest\Sockets\Stream($lang))->setContextOptions($contextOptions) ; |
|
| 37 | + : (new RemoteRequest\Sockets\Stream($lang))->setContextOptions($contextOptions); |
|
| 38 | 38 | $this->processor = new RemoteRequest\Connection\Processor($lang, $pointer); |
| 39 | 39 | $this->target = $this->loadTarget(); |
| 40 | 40 | $this->query = $this->loadQuery(); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | |
| 51 | 51 | public function hasKey(): bool |
| 52 | 52 | { |
| 53 | - return (empty($this->host))? false : (!empty(static::$key[$this->host])); |
|
| 53 | + return (empty($this->host)) ? false : (!empty(static::$key[$this->host])); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | unsigned char *t; |
| 14 | 14 | for(t = packet_start, sum = 0; t < packet_end; sum += *t++); |
| 15 | 15 | checksum= sum + (sum >> 8); |
| 16 | - |
|
| 17 | 16 | * PHP, Perl |
| 18 | 17 | $len = strlen($packet); |
| 19 | 18 | $packet[1] = chr(0); // at first null checksum in packet |