X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Frequest%2Fconsole%2Fclass_ConsoleRequest.php;h=af7278585c900998a1347a3d89f1642934cd56f7;hp=6aa36c57cda541477715eea99e277647fad49a44;hb=refs%2Fheads%2Fmaster;hpb=a60894f1d6ef33613d2d0351075aa07aa257f304 diff --git a/framework/main/classes/request/console/class_ConsoleRequest.php b/framework/main/classes/request/console/class_ConsoleRequest.php index 6aa36c57..065430a1 100644 --- a/framework/main/classes/request/console/class_ConsoleRequest.php +++ b/framework/main/classes/request/console/class_ConsoleRequest.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Request; // Import framework stuff +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -11,7 +12,7 @@ use Org\Mxchange\CoreFramework\Request\Requestable; * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -34,7 +35,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { * * @return void */ - protected function __construct () { + private function __construct () { // Call parent constructor parent::__construct(__CLASS__); } @@ -65,7 +66,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { if ((!isset($_SERVER['argv'])) || (!isset($_SERVER['argc']))) { // Maybe not right PHP mode? (needs CLI?) trigger_error(sprintf('[%s:%d]: argv/argc not set: %s', __METHOD__, __LINE__, print_r($_SERVER, true)), E_USER_ERROR); - } // END - if + } // Get the "request data" from the command-line argument list $args = $_SERVER['argv']; @@ -74,13 +75,13 @@ class ConsoleRequest extends BaseRequest implements Requestable { if ($_SERVER['argc'] < 2) { // Skip this return; - } // END - if + } // Is the first element "index.php" ? if ($args[0] == 'index.php') { // Then remove it array_shift($args); - } // END - if + } // Try to determine next parameters foreach ($args as $arg) { @@ -95,7 +96,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { // Set a name=value pair escaped and secured $this->setRequestElement($argArray[0], escapeshellcmd($argArray[1])); } - } // END - foreach + } } /** @@ -105,9 +106,9 @@ class ConsoleRequest extends BaseRequest implements Requestable { * @return $headerValue Value of the header or 'null' if not found * @throws UnsupportedOperationException This method should never be called */ - public function getHeaderElement ($headerName) { + public function getHeaderElement (string $headerName) { // Console doesn't have any headers - throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } /** @@ -127,9 +128,9 @@ class ConsoleRequest extends BaseRequest implements Requestable { * @return $cookieValue Value of cookie or null if not found * @throws UnsupportedOperationException This method should never be called */ - public final function readCookie ($cookieName) { + public final function readCookie (string $cookieName) { // There are no cookies on console - throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } /** @@ -140,7 +141,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { */ public function isGetRequestMethod () { // Not support method - throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } /** @@ -151,7 +152,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { */ public function isHeadRequestMethod () { // Not support method - throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } /** @@ -162,7 +163,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { */ public function isPostRequestMethod () { // Not support method - throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } }