]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 17 Jan 2021 06:33:09 +0000 (07:33 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 17 Jan 2021 06:33:09 +0000 (07:33 +0100)
- only __CLASS__ is out-dated
- used "new" array style []

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/client/http/class_HttpClient.php
framework/main/classes/output/class_
framework/main/classes/streams/class_
framework/main/classes/streams/input/class_
framework/main/classes/streams/output/class_
framework/main/classes/tasks/class_

index 23478c0487cab6dafa0adb0fd3715437db965a3c..c1794ef42daefa78f3356f5deebf64bfabc6a8ae 100644 (file)
@@ -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));
                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__];
 
                // 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
         */
         * @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
                // Initialize array
-               $response = array('', '', '');
+               $response = ['', '', ''];
 
                // Do the connect
                $respArray = $this->doConnectRequest($host, $port);
 
                // 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;
                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;
 
                // 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
         */
         * @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;
                // 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;
                        // 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;
 
                // 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);
 
                // 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;
                if (feof($this->getSocketResource())) {
                        // No response received
                        return $response;
-               } // END - if
+               }
 
                // Read the first line
                $resp = trim(fgets($this->getSocketResource(), 10240));
 
                // 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
         */
         * @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)
                // Prepare extra header(s)
-               $headers = array(
+               $headers = [
                        'Proxy-Connection' => 'Keep-Alive'
                        'Proxy-Connection' => 'Keep-Alive'
-               );
+               ];
 
                // Prepare raw request
                $responseArray = $this->sendRawHttpRequest('CONNECT', $host, $port, $headers);
 
                // Prepare raw request
                $responseArray = $this->sendRawHttpRequest('CONNECT', $host, $port, $headers);
index fc0aafd43cacbbe76050278022c7cae62a1b7ce9..7fd46736e54a3afe2482e5236842c3644f077978 100644 (file)
@@ -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) {
         * @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);
        }
 
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 50508138b9f9b27bd315ed70ecd5734331382a1d..623e73157e489550cdffa8d8604cc1b3048e27a7 100644 (file)
@@ -61,7 +61,7 @@ class ???Stream extends BaseStream implements Stream {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function streamData ($data) {
         * @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);
        }
 
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 8293e0733340a689a998109433741abf907bafec..41e9f177b68440c00612a5bf566d1887e1ba8cce 100644 (file)
@@ -60,7 +60,7 @@ class ???InputStream extends BaseStream implements InputStream {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function streamData ($data) {
         * @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);
        }
 
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 7ef52fad917f0e0083480d55dbbc991e437a3628..8b50864b71ce66c75f53bcdcc7de4b7b8e1063c8 100644 (file)
@@ -60,7 +60,7 @@ class ???OutputStream extends BaseStream implements OutputStream {
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function streamData ($data) {
         * @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);
        }
 
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
index 277d628c2fadb4fdccab27130f5caf00368c61a6..37ed91d54746d6701d1d1a8062cac9bcb48ac361 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
 <?php
 // Own namespace
-namespace Org\Mxchange\CoreFramework\Task\___;
+namespace Tld\Domain\Project\Task\___;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Task\BaseTask;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Task\BaseTask;
@@ -83,7 +83,7 @@ class !!!???Task extends BaseTask implements Taskable, Visitable {
         * @todo        0% done
         */
        public function doShutdown () {
         * @todo        0% done
         */
        public function doShutdown () {
-               self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...');
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...');
        }
 
 }
        }
 
 }