From c8362f6254141e97ff4688f687453494a8c031c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 17 Jan 2021 07:33:09 +0100 Subject: [PATCH] Continued: - only __CLASS__ is out-dated - used "new" array style [] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../classes/client/http/class_HttpClient.php | 22 +++++++++---------- framework/main/classes/output/class_ | 2 +- framework/main/classes/streams/class_ | 2 +- framework/main/classes/streams/input/class_ | 2 +- framework/main/classes/streams/output/class_ | 2 +- framework/main/classes/tasks/class_ | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/framework/main/classes/client/http/class_HttpClient.php b/framework/main/classes/client/http/class_HttpClient.php index 23478c04..c1794ef4 100644 --- a/framework/main/classes/client/http/class_HttpClient.php +++ b/framework/main/classes/client/http/class_HttpClient.php @@ -74,7 +74,7 @@ class HttpClient extends BaseClient implements Client { if (!isset($GLOBALS[__METHOD__])) { // Determine it $GLOBALS[__METHOD__] = ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_host') != '') && (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_port') > 0)); - } // END - if + } // Return cache return $GLOBALS[__METHOD__]; @@ -87,9 +87,9 @@ class HttpClient extends BaseClient implements Client { * @param $port Port number to connect to * @return $response Response array */ - protected function setupProxyTunnel ($host, $port) { + protected function setupProxyTunnel (string $host, int $port) { // Initialize array - $response = array('', '', ''); + $response = ['', '', '']; // Do the connect $respArray = $this->doConnectRequest($host, $port); @@ -98,7 +98,7 @@ class HttpClient extends BaseClient implements Client { if (((strtolower($respArray[0]) !== 'http/1.0') && (strtolower($respArray[0]) !== 'http/1.1')) || ($respArray[1] != '200')) { // Response code is not 200 return $response; - } // END - if + } // All fine! return $respArray; @@ -112,7 +112,7 @@ class HttpClient extends BaseClient implements Client { * @param $port Port number to connect to * @return $responseArray Array with raw response */ - private function sendRawHttpRequest ($method, $host, $port, array $header = []) { + private function sendRawHttpRequest (string $method, string $host, int $port, array $header = []) { // Minimum raw HTTP/1.1 request $rawRequest = $method . ' ' . $host . ':' . $port . ' HTTP/1.1' . self::HTTP_EOL; $rawRequest .= 'Host: ' . $host . ':' . $port . self::HTTP_EOL; @@ -122,11 +122,11 @@ class HttpClient extends BaseClient implements Client { // Add it as well $encodedAuth = base64_encode(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_username') . ':' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_password')); $rawRequest .= 'Proxy-Authorization: Basic ' . $encodedAuth . self::HTTP_EOL; - } // END - if + } // Add last new-line $rawRequest .= self::HTTP_EOL; - //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('HTTP-CLIENT: rawRequest=' . $rawRequest); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HTTP-CLIENT: rawRequest=' . $rawRequest); // Write request fwrite($this->getSocketResource(), $rawRequest); @@ -135,7 +135,7 @@ class HttpClient extends BaseClient implements Client { if (feof($this->getSocketResource())) { // No response received return $response; - } // END - if + } // Read the first line $resp = trim(fgets($this->getSocketResource(), 10240)); @@ -154,11 +154,11 @@ class HttpClient extends BaseClient implements Client { * @param $port Port number to connect to * @return $responseArray An array with the read response */ - public function doConnectRequest ($host, $port) { + public function doConnectRequest (string $host, int $port) { // Prepare extra header(s) - $headers = array( + $headers = [ 'Proxy-Connection' => 'Keep-Alive' - ); + ]; // Prepare raw request $responseArray = $this->sendRawHttpRequest('CONNECT', $host, $port, $headers); diff --git a/framework/main/classes/output/class_ b/framework/main/classes/output/class_ index fc0aafd4..7fd46736 100644 --- a/framework/main/classes/output/class_ +++ b/framework/main/classes/output/class_ @@ -101,7 +101,7 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable { * @throws UnsupportedOperationException If this method is called */ public function seek ($offset, $whence = SEEK_SET) { - self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('OUTPUT: offset=' . $offset . ',whence=' . $whence); throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/streams/class_ b/framework/main/classes/streams/class_ index 50508138..623e7315 100644 --- a/framework/main/classes/streams/class_ +++ b/framework/main/classes/streams/class_ @@ -61,7 +61,7 @@ class ???Stream extends BaseStream implements Stream { * @throws UnsupportedOperationException If this method is called */ public function streamData ($data) { - self::createDebugInstance(__CLASS__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/streams/input/class_ b/framework/main/classes/streams/input/class_ index 8293e073..41e9f177 100644 --- a/framework/main/classes/streams/input/class_ +++ b/framework/main/classes/streams/input/class_ @@ -60,7 +60,7 @@ class ???InputStream extends BaseStream implements InputStream { * @throws UnsupportedOperationException If this method is called */ public function streamData ($data) { - self::createDebugInstance(__CLASS__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/streams/output/class_ b/framework/main/classes/streams/output/class_ index 7ef52fad..8b50864b 100644 --- a/framework/main/classes/streams/output/class_ +++ b/framework/main/classes/streams/output/class_ @@ -60,7 +60,7 @@ class ???OutputStream extends BaseStream implements OutputStream { * @throws UnsupportedOperationException If this method is called */ public function streamData ($data) { - self::createDebugInstance(__CLASS__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/tasks/class_ b/framework/main/classes/tasks/class_ index 277d628c..37ed91d5 100644 --- a/framework/main/classes/tasks/class_ +++ b/framework/main/classes/tasks/class_ @@ -1,6 +1,6 @@ debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } -- 2.39.2