]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/commands/class_BaseCommand.php
Continued:
[core.git] / framework / main / classes / commands / class_BaseCommand.php
index 6d6a9ebc77110d502d68c9e4d141bfde7282aabf..49c357b89ac60d23c19af742193bb1edfdf1c738 100644 (file)
@@ -4,13 +4,15 @@ namespace Org\Mxchange\CoreFramework\Command;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\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;
-use Org\Mxchange\CoreFramework\Resolver\Resolver;
 use Org\Mxchange\CoreFramework\Response\Responseable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Resolver\ResolverTrait;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
+
 /**
  * A general (base) command
  *
@@ -34,15 +36,9 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseCommand extends BaseFrameworkSystem {
-       /**
-        * Resolver instance
-        */
-       private $resolverInstance = NULL;
-
-       /**
-        * Template engine instance
-        */
-       private $templateInstance = NULL;
+       // Load traits
+       use CompileableTemplateTrait;
+       use ResolverTrait;
 
        /**
         * Protected constructor
@@ -55,44 +51,6 @@ abstract class BaseCommand extends BaseFrameworkSystem {
                parent::__construct($className);
        }
 
-       /**
-        * Setter for resolver instance
-        *
-        * @param       $resolverInstance       Instance of a command resolver class
-        * @return      void
-        */
-       protected final function setResolverInstance (Resolver $resolverInstance) {
-               $this->resolverInstance = $resolverInstance;
-       }
-
-       /**
-        * Getter for resolver instance
-        *
-        * @return      $resolverInstance       Instance of a command resolver class
-        */
-       protected final function getResolverInstance () {
-               return $this->resolverInstance;
-       }
-
-       /**
-        * Setter for template engine instances
-        *
-        * @param       $templateInstance       An instance of a CompileableTemplate class
-        * @return      void
-        */
-       protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
-               $this->templateInstance = $templateInstance;
-       }
-
-       /**
-        * Getter for template engine instances
-        *
-        * @return      $templateInstance       An instance of a CompileableTemplate class
-        */
-       public final function getTemplateInstance () {
-               return $this->templateInstance;
-       }
-
        /**
         * Initializes the template engine
         *
@@ -120,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();