Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 6 Dec 2020 07:48:31 +0000 (08:48 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 6 Dec 2020 07:48:31 +0000 (08:48 +0100)
- Application instance in generic registry was a little of an overdoze when
  there is ApplicationHelper::getSelfInstance() around, this means lesser
  method invocations and a bit smaller footprint (one registry entry lesser)

Signed-off-by: Roland Häder <roland@mxchange.org>
41 files changed:
framework/main/classes/application/class_BaseApplication.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/commands/class_BaseCommand.php
framework/main/classes/commands/html/class_HtmlConfirmCommand.php
framework/main/classes/commands/html/class_HtmlHomeCommand.php
framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php
framework/main/classes/commands/html/class_HtmlLoginCommand.php
framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php
framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php
framework/main/classes/commands/html/class_HtmlRegisterCommand.php
framework/main/classes/commands/html/class_HtmlResendLinkCommand.php
framework/main/classes/commands/html/class_HtmlStatusCommand.php
framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php
framework/main/classes/controller/html/form/class_HtmlDoFormController.php
framework/main/classes/criteria/class_BaseCriteria.php
framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php
framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php
framework/main/classes/helper/captcha/images/class_ImageHelper.php
framework/main/classes/helper/html/links/class_HtmlLinkHelper.php
framework/main/classes/images/class_BaseImage.php
framework/main/classes/language/class_LanguageSystem.php
framework/main/classes/mailer/debug/class_DebugMailer.php
framework/main/classes/menu/class_BaseMenu.php
framework/main/classes/output/console/class_ConsoleOutput.php
framework/main/classes/resolver/action/class_BaseActionResolver.php
framework/main/classes/resolver/class_BaseResolver.php
framework/main/classes/resolver/controller/class_BaseControllerResolver.php
framework/main/classes/response/class_BaseResponse.php
framework/main/classes/response/html/class_HtmlResponse.php
framework/main/classes/response/image/class_ImageResponse.php
framework/main/classes/template/class_BaseTemplateEngine.php
framework/main/classes/template/console/class_ConsoleTemplateEngine.php
framework/main/classes/template/html/class_HtmlTemplateEngine.php
framework/main/classes/template/image/class_ImageTemplateEngine.php
framework/main/classes/template/mail/class_MailTemplateEngine.php
framework/main/classes/template/menu/class_MenuTemplateEngine.php
framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php
framework/main/classes/user/class_BaseUser.php
framework/main/classes/visitor/class_BaseVisitor.php
framework/main/interfaces/response/class_Responseable.php
framework/main/third_party/api/wernisportal/class_WernisApi.php

index bdf05189bac338848ee7ef9c62a65d6b9862533e..1c83f728bfc17c25f5d1e2cd12745882e70918ed 100644 (file)
@@ -4,9 +4,9 @@ namespace Org\Mxchange\CoreFramework\Application;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Controller\Controller;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 /**
  * A general application class for the ApplicationHelper classes.
@@ -65,9 +65,6 @@ abstract class BaseApplication extends BaseFrameworkSystem {
        protected function __construct (string $className) {
                // Call parent constructor
                parent::__construct($className);
-
-               // Set this instance as application instance
-               GenericRegistry::getRegistry()->addInstance('application', $this);
        }
 
        /**
index 2585985ae113542d3d02a6d4627c4727c5b0ea1e..526346cacc65ecae92248aecf79338a3160a0979 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Loader\ClassLoader;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
@@ -1642,7 +1643,7 @@ Loaded includes:
         */
        protected function initWebOutputInstance () {
                // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Init web output instance
                $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance));
index b66cb3ff45412546b66891ae50512a464fd2b4af..87cca6cff193386c233ec9feba3afc39ba30441d 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Command;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
@@ -77,7 +78,7 @@ abstract class BaseCommand extends BaseFrameworkSystem {
                assert(!$requestInstance->isPostRequestMethod());
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Transfer application data
                $this->getTemplateInstance()->assignApplicationData();
index e0ee64cf88b45252d0e3035f4ddf60ca908a344a..40ec5ddd196cbb68b764f2cb031a1ab7d99c547a 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
@@ -74,7 +75,7 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign application data with template engine
                $this->getTemplateInstance()->assignApplicationData();
index 5213906da36e7a64e96ba58cefd89dee22cde129..8127793cb7f1898df8d281ee831d8743564c112e 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -72,7 +73,7 @@ class HtmlHomeCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Prepare a template instance
                // Transfer application data
index 6ec51ebb0146c87ac12b94a3c8825a9a912ce578..95fac58a1918ed5ec2060b743fff40bd0943c438 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -100,7 +101,7 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable {
                }
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign base URL
                $this->getTemplateInstance()->assignConfigVariable('base_url');
@@ -174,11 +175,8 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable {
         * @return      void
         */
        public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Get registry
-               $registryInstance = GenericRegistry::getRegistry();
-
                // Get our application instance from the registry
-               $applicationInstance = $registryInstance->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Default action is the one from configuration
                $this->actionName = StringUtils::convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_default_action');
index 77f9be23716bcdbb8f505f7350e0730a4a46bdbf..01f05c6b3af93cd5a9bdc6ae2bbdd0d1809bd7fa 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -75,7 +76,7 @@ class HtmlLoginCommand extends BaseCommand implements Commandable {
                GenericRegistry::getRegistry()->addInstance('extra', $this);
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign application data with template engine
                $this->getTemplateInstance()->assignApplicationData();
index 6507520cf8678a78fca0bb6eca34dcb55224b3ca..0172fdf4240dff3c5b1b9788b3cb8a996a80eea9 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -72,7 +73,7 @@ class HtmlLoginFailedCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign application data with template engine
                $this->getTemplateInstance()->assignApplicationData();
index 6ef72aca5f59e2cb373d8493503ee1b46067e30f..13f69e8d6302653d8de7c5b2415d9ce95941553a 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -72,7 +73,7 @@ class HtmlLogoutDoneCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign application data
                $this->getTemplateInstance()->assignApplicationData();
index 1c65919a4451aedae2d64823fa95bc262e9a6e5e..7ca5a6edbd607f9fcec1e9c5a0ed26ba8eeef95f 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -75,7 +76,7 @@ class HtmlRegisterCommand extends BaseCommand implements Commandable {
                GenericRegistry::getRegistry()->addInstance('extra', $this);
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign all the application's data with template variables
                $this->getTemplateInstance()->assignApplicationData();
index 7ddcc8b4fd65757cf2ca4b6d2cc323bd8a13fa56..ab8974dbadef3015f546ed38d991f73284f1b6df 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -76,7 +77,7 @@ class HtmlResendLinkCommand extends BaseCommand implements Commandable {
                $userInstance = GenericRegistry::getRegistry()->getInstance('user');
 
                // Get an application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Get a RNG instance (Random Number Generator)
                $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
index 485ca585e63d70985818beecf930943db8621090..57cf347e20e0581a33d4daf9263a89ffae087138 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand;
 use Org\Mxchange\CoreFramework\Command\Commandable;
 use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+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;
@@ -72,7 +73,7 @@ class HtmlStatusCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Transfer application data
                $this->getTemplateInstance()->assignApplicationData();
index ea5f737d19f59497f8350edd39fd1a6f840dd653..53709e65cff2dd0498fa9a98ce980e3e605d5691 100644 (file)
@@ -6,6 +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\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -73,7 +74,7 @@ class ImageCodeCaptchaCommand extends BaseCommand implements Commandable {
                $decryptedCode = $requestInstance->getRequestElement('decrypted');
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign variable
                $this->getTemplateInstance()->assignVariable('decrypted_code', $decryptedCode);
index e5c1537d1b140379530d79d27ae43638aed9e019..177705d5eb59af69a47b63b4683283bdd37fe390 100644 (file)
@@ -55,9 +55,6 @@ class HtmlDoFormController extends BaseController implements Controller {
                // Set resolver instance
                $controllerInstance->setResolverInstance($resolverInstance);
 
-               // We need the controller instance in resolver class so set it here
-               $resolverInstance->setControllerInstance($controllerInstance);
-
                // Return the prepared instance
                return $controllerInstance;
        }
index e38926cf2e928fd3486b2518ca9930c664e30c08..db77c59e21d24eda8b25b70d599912bdc1bd029d 100644 (file)
@@ -236,10 +236,8 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                // Make sure no 'my-' or 'my_' passes this point
                assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false) && (!is_bool($criteriaValue)));
 
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '(' . $this->__toString() . ')-CRITERIA: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue);
-
                // Add it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '(' . $this->__toString() . ')-CRITERIA: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue);
                $this->pushValueToGenericArrayElement('criteria', 'choice', 'entries', StringUtils::convertDashesToUnderscores($criteriaKey), (string) $criteriaValue);
        }
 
@@ -264,7 +262,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      void
         */
-       public final function addConfiguredCriteria ($criteriaKey, $configEntry, string $criteriaType = 'default') {
+       public final function addConfiguredCriteria (string $criteriaKey, string $configEntry, string $criteriaType = 'default') {
                // Add the configuration entry as a criteria
                $value = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry);
                $this->addCriteria($criteriaKey, $value, $criteriaType);
@@ -277,20 +275,16 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      $value                  Whether the value of the critera or false
         */
-       public function getCriteriaElemnent ($criteriaKey, string $criteriaType = 'default') {
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA: criteriaKey=' . $criteriaKey . ',criteriaType=' . $criteriaType . ' - CALLED!');
-
+       public function getCriteriaElemnent (string $criteriaKey, string $criteriaType = 'default') {
                // Make sure no 'my-' or 'my_' passes this point
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA: criteriaKey=' . $criteriaKey . ',criteriaType=' . $criteriaType . ' - CALLED!');
                assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false));
 
                // Convert dashes to underscore
                $criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
 
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA: criteriaKey=' . $criteriaKey . ',criteria()=' . $this->countGenericArrayGroup('criteria', $criteriaType));
-
                // Default is not found
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA: criteriaKey=' . $criteriaKey . ',criteria()=' . $this->countGenericArrayGroup('criteria', $criteriaType));
                $value = false;
 
                // Is the criteria there?
@@ -299,10 +293,8 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                        $value = $this->getGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey);
                } // END - if
 
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA: value=' . $value . ' - EXIT!');
-
                // Return the value
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA: value=' . $value . ' - EXIT!');
                return $value;
        }
 
index 52a197b1abfe23c0e10e1e9579f3e2757bab6605..6816e4e4c6165f2655f1fd972da513e8cc28ae9a 100644 (file)
@@ -232,8 +232,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework
         * @param       $pathName       The new path name
         * @return      void
         */
-       protected final function setPathName ($pathName) {
-               $pathName = (string) $pathName;
+       protected final function setPathName (string $pathName) {
                $this->pathName = $pathName;
        }
 
index 08737bdf1d6a1bbeafaef853fce053e2cd294de1..1588a795525fae1bdd3d28652117bdcd063beca9 100644 (file)
@@ -91,8 +91,8 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable {
         * @param       $actionName             Action name to set
         * @return      void
         */
-       protected final function setActionName ($actionName) {
-               $this->actionName = (string) $actionName;
+       protected final function setActionName (string $actionName) {
+               $this->actionName = $actionName;
        }
 
        /**
index a1ef9add7b824ba0be86309d0c6ee55e21fcfebd..739c9777c29df5292ef82d35394cc393cbb0edd5 100644 (file)
@@ -53,20 +53,20 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
        /**
         * Array for background color values
         */
-       private $backgroundColor = array(
+       private $backgroundColor = [
                'red'   => 0,
                'green' => 0,
                'blue'  => 0
-       );
+       ];
 
        /**
         * Array for foreground color values
         */
-       private $foregroundColor = array(
+       private $foregroundColor = [
                'red'   => 0,
                'green' => 0,
                'blue'  => 0
-       );
+       ];
 
        /**
         * All image strings
@@ -100,7 +100,7 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
         * @param       $imageType                      Type of the image
         * @return      $helperInstance         A preparedf instance of this helper
         */
-       public static final function createImageHelper (CompileableTemplate $templateInstance, $imageType) {
+       public static final function createImageHelper (CompileableTemplate $templateInstance, string $imageType) {
                // Get new instance
                $helperInstance = new ImageHelper();
 
@@ -267,7 +267,7 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
         *
         * @param       $stringName             String name (identifier)
         */
-       public function addTextLine ($stringName) {
+       public function addTextLine (string $stringName) {
                // Create the image string
                $this->imageStrings[$stringName] = array(
                        'x'      => '',
@@ -286,8 +286,8 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
         * @param       $imageString    A message to display in image
         * @return      void
         */
-       public final function setImageString ($imageString) {
-               $this->imageStrings[$this->currString]['string'] = (string) $imageString;
+       public final function setImageString (string $imageString) {
+               $this->imageStrings[$this->currString]['string'] = $imageString;
        }
 
        /**
@@ -306,9 +306,9 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
         * @param       $y      Y coordinate
         * @return      void
         */
-       public final function setCoord ($x, $y) {
-               $this->imageStrings[$this->currString]['x'] = (int) $x;
-               $this->imageStrings[$this->currString]['y'] = (int) $y;
+       public final function setCoord (int $x, int $y) {
+               $this->imageStrings[$this->currString]['x'] = $x;
+               $this->imageStrings[$this->currString]['y'] = $y;
        }
 
        /**
index e603d80521eb9b24f3a4027bc8e2d3307f6c2325..6ad107220caa206dd40548c347328c5201861fa0 100644 (file)
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
 use Org\Mxchange\CoreFramework\Configuration\NoConfigEntryException;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
@@ -85,7 +86,7 @@ class HtmlLinkHelper extends BaseHtmlHelper implements HelpableTemplate {
                $helperInstance->setLinkName($linkName);
 
                // Get the application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Get the request instance
                $requestInstance = FrameworkBootstrap::getRequestInstance();
index 5ba5ce437815f3415473e4138a6276e02adaaa83..949f0c5a8fcb012f8db32c530ea49d7d46a8a54e 100644 (file)
@@ -324,8 +324,8 @@ abstract class BaseImage extends BaseFrameworkSystem implements Registerable {
         * @param       $string         String to set in image
         * @return      void
         */
-       public final function setString ($string) {
-               $this->imageString = (string) $string;
+       public final function setString (string $string) {
+               $this->imageString = $string;
        }
 
        /**
@@ -362,8 +362,8 @@ abstract class BaseImage extends BaseFrameworkSystem implements Registerable {
         * @param       $name   Name of the image
         * @return      void
         */
-       public final function setImageName ($name) {
-               $this->imageName = (string) $name;
+       public final function setImageName (string $name) {
+               $this->imageName = $name;
        }
 
        /**
index c8cc07a08309ea3f48ac2b95a158e5b9fb05d342..d3791d37a0b73f62a38b6ea4122d3432666e16ed 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Localization;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\ObjectArray\FrameworkArrayObject;
@@ -87,7 +88,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                if (empty($languageBasePath)) {
                        // No, then attempt "auto-dection":
                        // 1) Get application
-                       $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+                       $applicationInstance = ApplicationHelper::getSelfInstance();
 
                        // 2) Try to build it
                        $languageBasePath = sprintf('%s%s/language/',
@@ -141,7 +142,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
         */
        protected final function setLanguageBasePath (string $languageBasePath) {
                // And set it
-               $this->languageBasePath = (string) $languageBasePath;
+               $this->languageBasePath = $languageBasePath;
        }
 
        /**
@@ -167,7 +168,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                 *
                 * Origin: StatusNet's lib/language.php
                 */
-               $localeCategories = array(
+               foreach ([
                        'LC_CTYPE',
                        'LC_NUMERIC',
                        'LC_TIME',
@@ -175,16 +176,13 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                        'LC_MONETARY',
                        'LC_MESSAGES',
                        'LC_ALL'
-               );
-
-               // Set all, if not defined
-               foreach ($localeCategories as $key => $name) {
+               ] as $key => $name) {
                        // Is it set?
                        if (!defined($name)) {
                                // No, then set it
                                define($name, $key);
-                       } // END - if
-               } // END - foreach
+                       }
+               }
 
                // Init language strings array
                $this->langStrings = new FrameworkArrayObject('FakedLanguageStrings');
index 810163f8467c1848a2504adb8e29f0f2da1e66a9..4f1c8ec670c14ce9b261dbf0e20bde8a0a6674a7 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Mailer\Debug;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Mailer\BaseMailer;
 use Org\Mxchange\CoreFramework\Mailer\DeliverableMail;
 use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember;
@@ -173,7 +174,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
                $templateInstance->assignTemplateWithVariable('footer', 'footer');
 
                // Get master template name
-               $masterTemplateName = GenericRegistry::getRegistry()->getInstance('application')->buildMasterTemplateName();
+               $masterTemplateName = ApplicationHelper::getSelfInstance()->buildMasterTemplateName();
 
                // Load the master template
                $templateInstance->loadCodeTemplate($masterTemplateName);
index 2defb635302b403f97425e41a294767bdb17010b..f73d34e0b3118bfd7cadc399ee41b29151faa67b 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Menu;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
@@ -69,7 +70,7 @@ abstract class BaseMenu extends BaseFrameworkSystem {
                // If page is empty, choose default
                if (empty($command)) {
                        // Use default page as none has been specified
-                       $command = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('default_' . GenericRegistry::getRegistry()->getInstance('application')->getAppShortName() . '_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command');
+                       $command = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('default_' . ApplicationHelper::getSelfInstance()->getAppShortName() . '_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command');
                } // END - if
 
                // Load the menu template for this page
index 9dcae9763f803a0bdc145f9f6bd8af02a543a6b4..3ffff09fcfb9adfcfee9035b8a38af11e25494bb 100644 (file)
@@ -53,9 +53,8 @@ class ConsoleOutput extends BaseOutput implements OutputStreamer {
         * @param       $contentType    A valid content-type
         * @return      $debugInstance  An instance of this middleware class
         */
-       public static final function createConsoleOutput ($contentType) {
+       public static final function createConsoleOutput (string $contentType) {
                // Cast the content-type to string
-               $contentType = (string) $contentType;
                $contentType = trim($contentType);
 
                // Get instance
index 6a30c35c2a509534525ee9ffbbc367719d2adfb6..3578fb3df7b36f57034b7fbbd7f6ab02f5aa2c65 100644 (file)
@@ -55,8 +55,8 @@ abstract class BaseActionResolver extends BaseResolver {
         * @param       $actionName     Last validated action name
         * @return      void
         */
-       protected final function setActionName ($actionName) {
-               $this->actionName = (string) $actionName;
+       protected final function setActionName (string $actionName) {
+               $this->actionName = $actionName;
        }
 
        /**
index c92a0ab263bd386565c1ff7b10aaeb9c475c14c1..58816825f03653e0d1f190ee56bbb04b1ad89a87 100644 (file)
@@ -3,7 +3,6 @@
 namespace Org\Mxchange\CoreFramework\Resolver;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
@@ -57,11 +56,6 @@ abstract class BaseResolver extends BaseFrameworkSystem {
         */
        private $resolvedInstance = NULL;
 
-       /**
-        * A controller instance
-        */
-       private $controllerInstance = NULL;
-
        /**
         * Protected constructor
         *
@@ -142,8 +136,8 @@ abstract class BaseResolver extends BaseFrameworkSystem {
         * @param       $classPrefix    Last validated classPrefix
         * @return      void
         */
-       protected final function setClassPrefix ($classPrefix) {
-               $this->classPrefix = (string) $classPrefix;
+       protected final function setClassPrefix (string $classPrefix) {
+               $this->classPrefix = $classPrefix;
        }
 
        /**
@@ -165,23 +159,4 @@ abstract class BaseResolver extends BaseFrameworkSystem {
                $this->resolvedInstance = $resolvedInstance;
        }
 
-       /**
-        * Setter for controller instance (this surely breaks a bit the MVC patterm)
-        *
-        * @param       $controllerInstance             An instance of the controller
-        * @return      void
-        */
-       public final function setControllerInstance (Controller $controllerInstance) {
-               $this->controllerInstance = $controllerInstance;
-       }
-
-       /**
-        * Getter for controller instance (this surely breaks a bit the MVC patterm)
-        *
-        * @return      $controllerInstance             An instance of the controller
-        */
-       public final function getControllerInstance () {
-               return $this->controllerInstance;
-       }
-
 }
index c67f501f0068e9e7e335a5ed0ab8367170cd840f..cf828e610c374c27bfcbcdd0804e4df7768abdcc 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Controller\DefaultControllerException;
 use Org\Mxchange\CoreFramework\Controller\InvalidControllerException;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Resolver\BaseResolver;
 use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
@@ -88,9 +89,6 @@ abstract class BaseControllerResolver extends BaseResolver {
                // Cache default controller
                $defaultController = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('default_' . strtolower($this->getClassPrefix()) . '_controller');
 
-               // Init controller instance
-               $controllerInstance = NULL;
-
                // Create full class name
                $className = sprintf(
                        '%s\%sDefaultNewsController',
@@ -138,9 +136,11 @@ abstract class BaseControllerResolver extends BaseResolver {
                        $resolverConfigEntry,
                        array(
                                $controllerName,
-                               GenericRegistry::getRegistry()->getInstance('application')
+                               ApplicationHelper::getSelfInstance()
                        )
                );
+
+               // Get controller instance
                $controllerInstance = ObjectFactory::createObjectByName(
                        $this->getClassName(),
                        array($resolverInstance)
@@ -227,7 +227,6 @@ abstract class BaseControllerResolver extends BaseResolver {
        public function resolveController () {
                // Init variables
                $controllerName = $this->getControllerName();
-               $controllerInstance = NULL;
 
                // Get the controller
                $controllerInstance = $this->loadController($controllerName);
index 7d22336533c98703f625cb9ad8fedb55ed9bb30d..9f364bb17c986d6cfedf5f1bfd21967a70e9ad64 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
@@ -75,8 +76,8 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @param       $status         New response status
         * @return      void
         */
-       public final function setResponseStatus ($status) {
-               $this->responseStatus = (string) $status;
+       public final function setResponseStatus (string $status) {
+               $this->responseStatus = $status;
        }
 
        /**
@@ -86,7 +87,7 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @param       $value  Value of header element
         * @return      void
         */
-       public final function addHeader ($name, $value) {
+       public final function addHeader (string $name, $value) {
                $this->responseHeaders[$name] = $value;
        }
 
@@ -105,7 +106,7 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @param       $output         Output we shall sent in the HTTP response
         * @return      void
         */
-       public final function writeToBody ($output) {
+       public final function writeToBody (string $output) {
                $this->responseBody .= $output;
        }
 
@@ -125,7 +126,7 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @param       $responseType   Response type
         * @return      void
         */
-       protected final function setResponseType ($responseType) {
+       protected final function setResponseType (string $responseType) {
                $this->responseType = $responseType;
        }
 
@@ -146,7 +147,7 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @param       $messageId      The message id we shall add
         * @return      void
         */
-       public final function addFatalMessage ($messageId) {
+       public final function addFatalMessage (string $messageId) {
                // Adds the resolved message id to the fatal message list
                $this->addFatalMessagePlain(FrameworkBootstrap::getLanguageInstance()->getMessage($messageId));
        }
@@ -157,7 +158,7 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @param       $message        The plain message we shall add
         * @return      void
         */
-       public final function addFatalMessagePlain ($message) {
+       public final function addFatalMessagePlain (string $message) {
                // Adds the resolved message id to the fatal message list
                $this->pushValueToGenericArrayKey('fatal_messages', 'generic', 'message', $message);
        }
@@ -171,9 +172,9 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
         *                                                                                                      already sent
         */
-       public function flushBuffer ($force = false) {
+       public function flushBuffer (bool $force = false) {
                // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Headers already sent?
                if ((headers_sent()) && ($force === false)) {
@@ -236,7 +237,7 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         */
        public function determineDefaultCommand () {
                // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Generate config key
                $configKey = sprintf('default_%s_%s_command',
index 2cba458d512eda014f79a205bc30b555edc5a607..9ef39d644d782eb69fdc57e4302186d6eaccc173 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Response\Responseable;
@@ -70,7 +71,6 @@ class HtmlResponse extends BaseResponse implements Responseable {
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         * @todo        Encryption of cookie data not yet supported.
-        * @todo        Why are these parameters conflicting?
         * @todo        If the return statement is removed and setcookie() commented out,
         * @todo        this will send only one cookie out, the first one.
         */
@@ -123,7 +123,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
         */
        public function redirectToConfiguredUrl ($configEntry) {
                // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Is the header not yet sent?
                if (headers_sent()) {
@@ -173,7 +173,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
         * @param       $cookieName             Cookie to expire
         * @return      void
         */
-       public function expireCookie ($cookieName) {
+       public function expireCookie (string $cookieName) {
                // Is the cookie there?
                if (isset($_COOKIE[$cookieName])) {
                        // Then expire it with 20 minutes past
@@ -190,7 +190,7 @@ class HtmlResponse extends BaseResponse implements Responseable {
         * @param       $cookieName             Cookie to refresh
         * @return      void
         */
-       public function refreshCookie ($cookieName) {
+       public function refreshCookie (string $cookieName) {
                // Only update existing cookies
                if (isset($_COOKIE[$cookieName])) {
                        // Update the cookie
index 5354c0ecb54bbb6ad4c06202668661236c5b1e4a..8bb696da8433a16d0f76665c8972989ffd61120a 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Image\BaseImage;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -95,7 +96,6 @@ class ImageResponse extends BaseResponse implements Responseable {
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         * @todo        Encryption of cookie data not yet supported.
-        * @todo        Why are these parameters conflicting?
         * @todo        If the return statement is removed and setcookie() commented out,
         * @todo        this will send only one cookie out, the first one.
         */
@@ -144,9 +144,9 @@ class ImageResponse extends BaseResponse implements Responseable {
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
-       public function redirectToConfiguredUrl ($configEntry) {
+       public function redirectToConfiguredUrl (string $configEntry) {
                // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Is the header not yet sent?
                if (headers_sent()) {
@@ -195,7 +195,7 @@ class ImageResponse extends BaseResponse implements Responseable {
         *                                      already sent with an exception
         * @return      void
         */
-       public function flushBuffer ($force = false) {
+       public function flushBuffer (bool $force = false) {
                // Finish the image
                $this->getImageInstance()->finishImage();
 
@@ -218,7 +218,7 @@ class ImageResponse extends BaseResponse implements Responseable {
         * @param       $cookieName             Cookie to expire
         * @return      void
         */
-       public function expireCookie ($cookieName) {
+       public function expireCookie (string $cookieName) {
                // Is the cookie there?
                if (isset($_COOKIE[$cookieName])) {
                        // Then expire it with 20 minutes past
@@ -235,7 +235,7 @@ class ImageResponse extends BaseResponse implements Responseable {
         * @param       $cookieName             Cookie to refresh
         * @return      void
         */
-       public function refreshCookie ($cookieName) {
+       public function refreshCookie (string $cookieName) {
                // Only update existing cookies
                if (isset($_COOKIE[$cookieName])) {
                        // Update the cookie
index 8c09dfbf91a01dfa65b5c601a73932a3500a3181..523c273d408fe1c28500d81cb7d385adef3f1e53 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -1209,7 +1210,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function assignApplicationData () {
                // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Get long name and assign it
                $this->assignVariable('app_full_name' , $applicationInstance->getAppName());
index a718d80d5a1dce0e442d0b244db61ad2a670f60d..85d61d6dc5075f9744809efd4c3751c04cb8a071 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
@@ -61,7 +62,7 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem
                $templateInstance = new ConsoleTemplateEngine();
 
                // Get the application instance from registry
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Determine base path
                $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
index 32513179b02c6f459afc448351117445f30e717a..76dac48c78cc77cfc4419b9fea3507722ff80ae2 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
@@ -61,7 +62,7 @@ class HtmlTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                $templateInstance = new HtmlTemplateEngine();
 
                // Get the application instance from registry
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Determine base path
                $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
index d5efe92a33cf3251ba7c8bec549a62ebbeb3810c..925c96bf30305ef2e278fabf9a2cff3c8a2c331a 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Image\BaseImage;
 use Org\Mxchange\CoreFramework\Parser\Parseable;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -105,7 +106,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                $templateInstance = new ImageTemplateEngine();
 
                // Get the application instance from registry
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Determine base path
                $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
index 951093a02d8035570a4914dae127b9e15e4d5786..338fd7435783e14eacb4492d431e6792e0ad7014 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Mailer\DeliverableMail;
 use Org\Mxchange\CoreFramework\Parser\Parseable;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -95,7 +96,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                $templateInstance = new MailTemplateEngine();
 
                // Get the application instance from registry
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Determine base path
                $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
index 8d653dbdec7886448bd8f2605ad7ce0aec5f61bc..ed9468ef78b769382476e9096cedc1f14c2181e0 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Menu\RenderableMenu;
 use Org\Mxchange\CoreFramework\Parser\Parseable;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -157,7 +158,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                $templateInstance = new MenuTemplateEngine();
 
                // Get the application instance from registry
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Determine base path
                $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
@@ -391,7 +392,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         */
        private function initMenu (string $templateDependency = '') {
                // Get web template engine
-               $this->setTemplateInstance(ObjectFactory::createObjectByConfiguredName('html_template_class', array(GenericRegistry::getRegistry()->getInstance('application'))));
+               $this->setTemplateInstance(ObjectFactory::createObjectByConfiguredName('html_template_class', array(ApplicationHelper::getSelfInstance())));
 
                // Handle the dependency template
                $this->handleTemplateDependency('menu', $templateDependency);
@@ -889,7 +890,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         */
        public function getMenuCacheFile () {
                // Get the application instance from registry
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Get the file instance ready
                $fileInstance = new SplFileInfo(sprintf('%s%smenus/_cache/%s.%s',
index 6789a5629ebca79ed3a6efb48b4716a458f69178..253e0a8ab74c7a0514df467b58de7cca47c1c401 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Template\Engine\Xml;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
@@ -115,7 +116,7 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine implements Compi
                $this->typePrefix      = $typePrefix;
 
                // Get template instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Determine base path
                $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . FrameworkBootstrap::getRequestInstance()->getRequestElement('app') . '/';
index f5fb074ea0ac83ef9fe0c7830676eff9123633f4..c8e692f870fef93cc92ce7fc260fcfac2ced22a9 100644 (file)
@@ -76,8 +76,8 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @param       $userName       The username to set
         * @return      void
         */
-       public final function setUserName ($userName) {
-               $this->userName = (string) $userName;
+       public final function setUserName (string $userName) {
+               $this->userName = $userName;
        }
 
        /**
@@ -96,7 +96,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @return      void
         * @todo        Find a way of casting here. "(int)" might destroy the user id > 32766
         */
-       public final function setUserId ($userId) {
+       public final function setUserId (int $userId) {
                $this->userId = $userId;
        }
 
@@ -115,8 +115,8 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @param       $email  The email to set
         * @return      void
         */
-       protected final function setEmail ($email) {
-               $this->email = (string) $email;
+       protected final function setEmail (string $email) {
+               $this->email = $email;
        }
 
        /**
index 162fd53795c6aa9109746a4e49e75bd866cfcc3c..f53ab80235ceb0bec751f1d3bde6d66dfc6af2de 100644 (file)
@@ -50,8 +50,8 @@ abstract class BaseVisitor extends BaseFrameworkSystem {
         * @param       $visitorMode    New visitor mode to set
         * @return      void
         */
-       protected final function setVisitorMode ($visitorMode) {
-               $this->visitorMode = (string) $visitorMode;
+       protected final function setVisitorMode (string $visitorMode) {
+               $this->visitorMode = $visitorMode;
        }
 
        /**
index 0a302497048c019c69374193876f582afe8b61c3..f92b1401f03eddb57c1e0820b8ac9dcbc8e93e64 100644 (file)
@@ -34,7 +34,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $status         New response status
         * @return      void
         */
-       function setResponseStatus ($status);
+       function setResponseStatus (string $status);
 
        /**
         * Adds a header to the response. This method "wraps" the direct header()
@@ -47,7 +47,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $value  Value of header element
         * @return      void
         */
-       function addHeader ($name, $value);
+       function addHeader (string $name, $value);
 
        /**
         * "Writes" data to the response body
@@ -55,7 +55,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $output         Output we shall sent in the HTTP response
         * @return      void
         */
-       function writeToBody ($output);
+       function writeToBody (string $output);
 
        /**
         * Flushs the cached HTTP response to the outer world
@@ -66,7 +66,7 @@ interface Responseable extends FrameworkInterface {
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
         *                                                                                                      already sent
         */
-       function flushBuffer ($force = false);
+       function flushBuffer (bool $force = false);
 
        /**
         * Adds a fatal message id to the response. The added messages can then be
@@ -75,7 +75,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $messageId      The message id we shall add
         * @return      void
         */
-       function addFatalMessage ($messageId);
+       function addFatalMessage (string $messageId);
 
        /**
         * Adds a cookie to the response
@@ -98,7 +98,7 @@ interface Responseable extends FrameworkInterface {
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
-       function redirectToConfiguredUrl ($configEntry);
+       function redirectToConfiguredUrl (string $configEntry);
 
        /**
         * Expires the given cookie if it is set
@@ -106,7 +106,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $cookieName             Cookie to expire
         * @return      void
         */
-       function expireCookie ($cookieName);
+       function expireCookie (string $cookieName);
 
        /**
         * Refreshs a given cookie. This will make the cookie live longer
@@ -114,6 +114,6 @@ interface Responseable extends FrameworkInterface {
         * @param       $cookieName             Cookie to refresh
         * @return      void
         */
-       function refreshCookie ($cookieName);
+       function refreshCookie (string $cookieName);
 
 }
index aa251029855fcbd6090129f3b9b700bc5ae1ae8b..e8dd99d78294075dc878bc438f04b462a5e62881 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace Wds66\Api;
+namespace Com\Wds66\Api;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
@@ -82,18 +82,21 @@ class WernisApi extends BaseFrameworkSystem {
        /**
         * Creates an instance of this API class
         *
-        * @param       $cfg                    Configuration array
+        * @param       $configArray                    Configuration array
         * @return      $apiInstance    An instance of this API class
         */
-       public static final function createWernisApi (array $cfg) {
+       public static final function createWernisApi (array $configArray) {
                // Create a new instance
                $apiInstance = new WernisApi();
 
-               // Fix missing
-               if (!isset($cfg['api_url'])) $cfg['api_url'] = self::$apiUrl;
+               // If not an api_url is given (e.g. on local development system)
+               if (!isset($configArray['api_url'])) {
+                       // ... then set the productive URL
+                       $configArray['api_url'] = self::$apiUrl;
+               }
 
                // Konfiguration uebertragen
-               $apiInstance->setCoonfigArray($cfg);
+               $apiInstance->setCoonfigArray($configArray);
 
                // Return the instance
                return $apiInstance;
@@ -106,7 +109,7 @@ class WernisApi extends BaseFrameworkSystem {
         * @param       $w_pwd  Clear password of the gamer
         * @return      void
         */
-       public function setUser ($w_id, $w_pwd) {
+       public function setUser (int $w_id, string $w_pwd) {
                // Set username (id)
                $this->w_id = $w_id;
 
@@ -118,10 +121,8 @@ class WernisApi extends BaseFrameworkSystem {
         * The following methods are not yet rewritten! *
         ************************************************/
 
-       public function einziehen ($amount) {
+       public function einziehen (int $amount) {
                // amount auf Gueltigkeit pruefen
-               $amount = isset($amount) ? $amount+0 : 0;
-
                if ($amount < $this->config['mineinsatz']) {
                        $this->setStatusMessage('low_stakes', sprintf('Dein Einsatz muss mindestens %d Wernis betragen.', $this->config['mineinsatz']));
                        return false;
@@ -131,10 +132,8 @@ class WernisApi extends BaseFrameworkSystem {
                return $this->executeWithdraw($amount);
        }
 
-       public function verschicken ($amount) {
+       public function verschicken (int $amount) {
                // amount auf Gueltigkeit pruefen
-               $amount = isset($amount) ? $amount+0 : 0;
-
                if ($amount < $this->config['mineinsatz']) {
                        $this->setStatusMessage('low_stakes', sprintf('Dein Einsatz muss mindestens %d Wernis betragen.', $this->config['mineinsatz']));
                        return false;
@@ -159,7 +158,7 @@ class WernisApi extends BaseFrameworkSystem {
        }
 
        // Sets a status message and code
-       public function setStatusMessage ($msg, $status) {
+       public function setStatusMessage (string $msg, string $status) {
                $this->statusArray['message'] = $msg;
                $this->statusArray['status'] = $status;
        }
@@ -187,7 +186,7 @@ class WernisApi extends BaseFrameworkSystem {
        }
 
        // Sends out a request to the API and returns it's result
-       private function sendRequest ($scriptName, array $requestData = array()) {
+       private function sendRequest (string $scriptName, array $requestData = []) {
                // Is the requestData an array?
                if (!is_array($requestData)) {
                        // Then abort here!
@@ -307,7 +306,7 @@ class WernisApi extends BaseFrameworkSystem {
        }
 
        // Widthdraw this amount
-       private function executeWithdraw ($amount) {
+       private function executeWithdraw (int $amount) {
                // First all fails...
                $result = false;
 
@@ -340,7 +339,7 @@ class WernisApi extends BaseFrameworkSystem {
        }
 
        // Payout this amount
-       private function executePayout ($amount) {
+       private function executePayout (int $amount) {
                // First all fails...
                $result = false;
 
@@ -373,7 +372,7 @@ class WernisApi extends BaseFrameworkSystem {
        }
 
        // Send raw GET request
-       private function sendRawRequest ($script) {
+       private function sendRawRequest (string $script) {
                // Use the hostname from script URL as new hostname
                $url = substr($script, 7);
                $extract = explode('/', $url);