]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php
Continued:
[core.git] / framework / main / classes / commands / image / class_ImageCodeCaptchaCommand.php
index 641e46ac7ad307ee13c8b07b6b8c53479f54624b..1d0da0585d37f2cde79d37051f80091f61863c7c 100644 (file)
@@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Command\Captcha;
 use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
 use Org\Mxchange\CoreFramework\Response\Responseable;
@@ -16,7 +16,7 @@ use Org\Mxchange\CoreFramework\Response\Responseable;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @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
  *
@@ -39,7 +39,7 @@ class ImageCodeCaptchaCommand extends BaseCommand implements Commandable {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -50,7 +50,7 @@ class ImageCodeCaptchaCommand extends BaseCommand implements Commandable {
         * @param       $resolverInstance       An instance of a command resolver class
         * @return      $commandInstance        An instance a prepared command class
         */
-       public static final function createImageCodeCaptchaCommand (CommandResolver $resolverInstance) {
+       public static final function createImageCodeCaptchaCommand (CommandResolver $resolverInstance): Commandable {
                // Get new instance
                $commandInstance = new ImageCodeCaptchaCommand();
 
@@ -68,30 +68,27 @@ class ImageCodeCaptchaCommand extends BaseCommand implements Commandable {
         * @param       $responseInstance       An instance of a class with an Responseable interface
         * @return      void
         */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+       public function execute (Requestable $requestInstance, Responseable $responseInstance): void {
                // Get the decrypted string from request (previously created by a filter!)
                $decryptedCode = $requestInstance->getRequestElement('decrypted');
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
-
-               // Prepare a template instance
-               $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign variable
-               $templateInstance->assignVariable('decrypted_code', $decryptedCode);
+               $this->getTemplateInstance()->assignVariable('decrypted_code', $decryptedCode);
 
                // Load the code (pardon, image...) template
-               $templateInstance->loadCodeTemplate('code_captcha');
+               $this->getTemplateInstance()->loadCodeTemplate('code_captcha');
 
                // Compile the template
-               $templateInstance->compileTemplate();
+               $this->getTemplateInstance()->compileTemplate();
 
                // Compile all variables
-               $templateInstance->compileVariables();
+               $this->getTemplateInstance()->compileVariables();
 
                // Transfer it to the response
-               $templateInstance->transferToResponse($responseInstance);
+               $this->getTemplateInstance()->transferToResponse($responseInstance);
        }
 
        /**
@@ -101,7 +98,7 @@ class ImageCodeCaptchaCommand extends BaseCommand implements Commandable {
         * @param       $requestInstance                An instance of a class with an Requestable interface
         * @return      void
         */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance): void {
                // Extra filters here...
        }