@@ -78,7 +78,7 @@ |
||
78 | 78 | throw new ResponseParserException("Failed to match " . self::MATCHES['message'] . " pattern."); |
79 | 79 | } |
80 | 80 | |
81 | - return str_replace("\r",'',$matches[0]); // remove the carriage return from the end |
|
81 | + return str_replace("\r", '', $matches[0]); // remove the carriage return from the end |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -47,8 +47,8 @@ |
||
47 | 47 | */ |
48 | 48 | final public function write($command) |
49 | 49 | { |
50 | - if (($write = fwrite($this->stream, trim($command).self::CRLF)) !== false && $this->logger) { |
|
51 | - $this->logger->command($command.self::CRLF); |
|
50 | + if (($write = fwrite($this->stream, trim($command) . self::CRLF)) !== false && $this->logger) { |
|
51 | + $this->logger->command($command . self::CRLF); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return $write; |
@@ -82,7 +82,7 @@ |
||
82 | 82 | */ |
83 | 83 | public function open() |
84 | 84 | { |
85 | - if($open = $this->openStreamSocket($this->host, $this->port, $this->timeout, $this->blocking)) { |
|
85 | + if ($open = $this->openStreamSocket($this->host, $this->port, $this->timeout, $this->blocking)) { |
|
86 | 86 | // TODO check the reply |
87 | 87 | $this->read(); |
88 | 88 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | // 3- listen to the socket on the local port that will |
59 | 59 | // be send along with PORT comamnd. |
60 | 60 | // 4- send the PORT command. |
61 | - if (is_resource($stream = stream_socket_server('tcp://0.0.0.0:'.$port, $errnon, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN))) { |
|
61 | + if (is_resource($stream = stream_socket_server('tcp://0.0.0.0:' . $port, $errnon, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN))) { |
|
62 | 62 | $this->commandStream->write("PORT $ip,$low,$high"); |
63 | 63 | $response = new Response($this->commandStream->read()); |
64 | 64 | if ($response->getCode() === 200) { |
@@ -35,6 +35,6 @@ |
||
35 | 35 | public function __construct($logger, $commandStream) |
36 | 36 | { |
37 | 37 | parent::__construct($logger); |
38 | - $this->commandStream = $commandStream; |
|
38 | + $this->commandStream = $commandStream; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -100,7 +100,7 @@ |
||
100 | 100 | $output .= ']'; |
101 | 101 | |
102 | 102 | if ($this->write($output) === false) { |
103 | - throw new FileLoggerException("Cannot write to file " . $this->filePath."."); |
|
103 | + throw new FileLoggerException("Cannot write to file " . $this->filePath . "."); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
@@ -51,7 +51,9 @@ |
||
51 | 51 | $lines = explode(self::CRLF, $message); |
52 | 52 | $this->logs[] = sprintf("%s %s", $level, $lines[0]); |
53 | 53 | foreach ($lines as $key => $line) { |
54 | - if ($key === 0 || $line === '') continue; |
|
54 | + if ($key === 0 || $line === '') { |
|
55 | + continue; |
|
56 | + } |
|
55 | 57 | $this->logs[] = $line; |
56 | 58 | } |
57 | 59 | } |
@@ -68,11 +68,11 @@ |
||
68 | 68 | */ |
69 | 69 | public function error($message); |
70 | 70 | |
71 | - /** |
|
72 | - * @param string $string |
|
73 | - * |
|
74 | - * @return void |
|
75 | - */ |
|
71 | + /** |
|
72 | + * @param string $string |
|
73 | + * |
|
74 | + * @return void |
|
75 | + */ |
|
76 | 76 | public function command($string); |
77 | 77 | |
78 | 78 | /** |