]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 1 Dec 2020 23:36:50 +0000 (00:36 +0100)
committerRoland Häder <roland@mxchange.org>
Tue, 1 Dec 2020 23:36:50 +0000 (00:36 +0100)
- Removed monolithic BaseFrameworkSystem->flushPendingUpdates()
- REFACTURING: moved some instances to traits, will continue with other
  instances after these have been tested

Signed-off-by: Roland Häder <roland@mxchange.org>
20 files changed:
framework/loader/class_ClassLoader.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/discovery/payment/class_LocalPaymentDiscovery.php
framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php
framework/main/classes/filter/update/class_UserUpdateFilter.php
framework/main/classes/points/class_UserPoints.php
framework/main/classes/reader/class_ConsoleNewsReader.php
framework/main/classes/reader/class_DefaultNewsReader.php
framework/main/classes/user/class_BaseUser.php
framework/main/classes/user/guest/class_Guest.php
framework/main/classes/user/member/class_Member.php
framework/main/interfaces/io/file/handler/class_IoHandler.php
framework/main/middleware/class_BaseMiddleware.php
framework/main/middleware/io/class_FileIoHandler.php
framework/main/traits/crypto/class_CryptoTrait.php [new file with mode: 0644]
framework/main/traits/manager/account/class_ManageableAccountTrait.php [new file with mode: 0644]
framework/main/traits/result/search/class_SearchableResultTrait.php [new file with mode: 0644]
framework/main/traits/streamer/file/input/class_FileInputStreamerTrait.php [new file with mode: 0644]
framework/main/traits/streamer/file/output/class_FileOutputStreamerTrait.php [new file with mode: 0644]
framework/main/traits/streamer/output/class_OutputStreamerTrait.php [new file with mode: 0644]

index 9e0e4bacf06e35c18356a0df568735a3ed29861a..194e89f17291b44a12b5f16f35a45f571883a61b 100644 (file)
@@ -123,12 +123,13 @@ class ClassLoader {
        /**
         * Framework/application paths for classes, etc.
         */
-       private static $frameworkPaths = array(
+       private static $frameworkPaths = [
+               'classes',    // Classes
                'exceptions', // Exceptions
                'interfaces', // Interfaces
-               'classes',    // Classes
-               'middleware'  // The middleware
-       );
+               'middleware', // The middleware
+               'traits',     // Traits
+       ];
 
        /**
         * Registered paths where test classes can be found. These are all relative
index 7c0ed665589d4db54f76355f997a079263464286..7195861e84f29f7bfc167c27de41413d186f91b8 100644 (file)
@@ -5,7 +5,6 @@ namespace Org\Mxchange\CoreFramework\Object;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Criteria\Criteria;
-use Org\Mxchange\CoreFramework\Crypto\Cryptable;
 use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
@@ -19,12 +18,10 @@ use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Result\Database\CachedDatabaseResult;
-use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
 use Org\Mxchange\CoreFramework\State\Stateable;
 use Org\Mxchange\CoreFramework\Stream\Input\InputStream;
 use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
 use Org\Mxchange\CoreFramework\Stream\Output\OutputStream;
-use Org\Mxchange\CoreFramework\User\ManageableAccount;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
@@ -73,21 +70,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         */
        private $realClass = __CLASS__;
 
-       /**
-        * Database result instance
-        */
-       private $resultInstance = NULL;
-
-       /**
-        * Instance for user class
-        */
-       private $userInstance = NULL;
-
-       /**
-        * Instance of a crypto helper
-        */
-       private $cryptoInstance = NULL;
-
        /**
         * Instance of an Iterator class
         */
@@ -220,9 +202,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         * @return      void
         */
        public function __destruct () {
-               // Flush any updated entries to the database
-               $this->flushPendingUpdates();
-
                // Is this object already destroyed?
                if ($this->__toString() != 'DestructedObject') {
                        // Destroy all informations about this class but keep some text about it alive
@@ -434,26 +413,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                $this->realClass = $realClass;
        }
 
-       /**
-        * Setter for database result instance
-        *
-        * @param       $resultInstance         An instance of a database result class
-        * @return      void
-        * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
-        */
-       protected final function setResultInstance (SearchableResult $resultInstance) {
-               $this->resultInstance =  $resultInstance;
-       }
-
-       /**
-        * Getter for database result instance
-        *
-        * @return      $resultInstance         An instance of a database result class
-        */
-       public final function getResultInstance () {
-               return $this->resultInstance;
-       }
-
        /**
         * Setter for debug instance
         *
@@ -497,44 +456,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                return $webOutputInstance;
        }
 
-       /**
-        * Protected setter for user instance
-        *
-        * @param       $userInstance   An instance of a user class
-        * @return      void
-        */
-       protected final function setUserInstance (ManageableAccount $userInstance) {
-               $this->userInstance = $userInstance;
-       }
-
-       /**
-        * Getter for user instance
-        *
-        * @return      $userInstance   An instance of a user class
-        */
-       public final function getUserInstance () {
-               return $this->userInstance;
-       }
-
-       /**
-        * Setter for Cryptable instance
-        *
-        * @param       $cryptoInstance An instance of a Cryptable class
-        * @return      void
-        */
-       protected final function setCryptoInstance (Cryptable $cryptoInstance) {
-               $this->cryptoInstance = $cryptoInstance;
-       }
-
-       /**
-        * Getter for Cryptable instance
-        *
-        * @return      $cryptoInstance An instance of a Cryptable class
-        */
-       public final function getCryptoInstance () {
-               return $this->cryptoInstance;
-       }
-
        /**
         * Setter for DatabaseWrapper instance
         *
@@ -974,6 +895,7 @@ Loaded includes:
         * @return      $entry  An array with database entries
         * @throws      NullPointerException    If the database result is not found
         * @throws      InvalidDatabaseResultException  If the database result is invalid
+        * @todo        Monolithic method, should be moved to proper classes
         */
        protected final function getDatabaseEntry () {
                // Is there an instance?
@@ -1075,28 +997,6 @@ Loaded includes:
                return $isSet;
        }
 
-       /**
-        * Flushs all pending updates to the database layer
-        *
-        * @return      void
-        */
-       public function flushPendingUpdates () {
-               // Get result instance
-               $resultInstance = $this->getResultInstance();
-
-               // Do we have data to update?
-               if ((is_object($resultInstance)) && ($resultInstance->ifDataNeedsFlush())) {
-                       // Get wrapper class name config entry
-                       $configEntry = $resultInstance->getUpdateInstance()->getWrapperConfigEntry();
-
-                       // Create object instance
-                       $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName($configEntry);
-
-                       // Yes, then send the whole result to the database layer
-                       $wrapperInstance->doUpdateByResult($this->getResultInstance());
-               }
-       }
-
        /**
         * Outputs a deprecation warning to the developer.
         *
index 74e05ab28c99d2b5ac5d1d8c85ed323b1e888d91..aaab6c2266b930585dff593b5fcb64dd6ba3b9c1 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Filter\Filterable;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Traits\Result\Search\SearchableResultTrait;
 
 /**
  * A local payment discovery class. This class looks in local database for
@@ -37,6 +38,9 @@ use Org\Mxchange\CoreFramework\Request\Requestable;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Registerable {
+       // Load traits
+       use SearchableResultTrait;
+
        /**
         * Protected constructor
         *
index 8eb0cb6066444da2f0ee30ef9e7752b7c7d3358b..1c41d370ee56569fa7ee610e0e448b463051acf2 100644 (file)
@@ -78,6 +78,7 @@ class UserStatusConfimedUpdateFilter extends BaseFilter implements Filterable {
                $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, '');
 
                // Write all updates to the database
+               die(__METHOD__ . ': REWRITE!' . PHP_EOL);
                $userInstance->flushPendingUpdates();
        }
 
index f0238dd6a0d7d3e1994d0417d31a6165d9900864..fd9d656c21aa1b99fbdd46d8e242fc5847d678d9 100644 (file)
@@ -76,6 +76,7 @@ class UserUpdateFilter extends BaseFilter implements Filterable {
                $authInstance->updateAuthData();
 
                // Write all updates to the database
+               die(__METHOD__ . ': REWRITE!' . PHP_EOL);
                $userInstance->flushPendingUpdates();
        }
 
index b07858dbcb5e6d83dcaa21f2f45a2ea5364b1172..e26856ad240f0b512a3c3930c6943f9c2d59e6a2 100644 (file)
@@ -9,6 +9,8 @@ use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Traits\Manager\Account\ManageableAccountTrait;
+use Org\Mxchange\CoreFramework\Traits\Result\Search\SearchableResultTrait;
 use Org\Mxchange\CoreFramework\User\ManageableAccount;
 
 /**
@@ -34,6 +36,10 @@ use Org\Mxchange\CoreFramework\User\ManageableAccount;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePoints {
+       // Load traits
+       use ManageableAccountTrait;
+       use SearchableResultTrait;
+
        /**
         * Amount of points
         */
index 0d1dbb970f5b614005097fd36707107e46539685..0f19c0aed67630bde663c24524b03b6eccad7ef4 100644 (file)
@@ -10,6 +10,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Reader\News\ReadableNews;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Traits\Result\Search\SearchableResultTrait;
 
 /**
  * A console news reader class reads news from database layer
@@ -34,6 +35,9 @@ use Org\Mxchange\CoreFramework\Request\Requestable;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
+       // Load traits
+       use SearchableResultTrait;
+
        /**
         * Protected constructor
         *
index ce0fd6f5bdc4670599ac2473bbf788ff08ec971d..8d67d32eb5b2e9e6e5a1aff618503878b1cfc5c4 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Traits\Result\Search\SearchableResultTrait;
 
 /**
  * A default news reader class reads news from database layer
@@ -33,6 +34,9 @@ use Org\Mxchange\CoreFramework\Request\Requestable;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
+       // Load traits
+       use SearchableResultTrait;
+
        /**
         * Protected constructor
         *
index 36791ab5770ebf67e48662bf76dddc518f07d491..f3da469e25f1b6445c98def6dcc4ae32ebe8325a 100644 (file)
@@ -10,6 +10,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
+use Org\Mxchange\CoreFramework\Traits\Result\Search\SearchableResultTrait;
 
 /**
  * A general user class
@@ -34,6 +35,9 @@ use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
+       // Load traits
+       use SearchableResultTrait;
+
        // Exception constances
        const EXCEPTION_USERNAME_NOT_FOUND   = 0x150;
        const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151;
index c7fb4b22b50ea879a3d2fda88fc574839daf0c85..2116e5b093d5c37790ae8207dafa23c1928148a4 100644 (file)
@@ -124,8 +124,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
 
        /**
         * Updates the last activity timestamp and last performed action in the
-        * database result. You should call flushPendingUpdates() to flush these updates
-        * to the database layer.
+        * database result.
         *
         * @param       $requestInstance        A requestable class instance
         * @return      void
@@ -134,13 +133,4 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
                // No activity will be logged for guest accounts
        }
 
-       /**
-        * Flushs all pending updates to the database layer
-        *
-        * @return      void
-        */
-       public function flushPendingUpdates () {
-               // No updates will be flushed to database!
-       }
-
 }
index 64b7cbbf31adec8bb9cd9f07dd4ecb7b3cf9fd32..07449e6877958c4762095ec210fd1761030d58b5 100644 (file)
@@ -120,8 +120,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
 
        /**
         * Updates the last activity timestamp and last performed action in the
-        * database result. You should call flushPendingUpdates() to flush these updates
-        * to the database layer.
+        * database result.
         *
         * @param       $requestInstance        A requestable class instance
         * @return      void
index a936a250a9f0a9d63fee2e2e8ee1340d4c91ca67..cf3f4adbccd9201882bc2568b08f83c88a3a50ee 100644 (file)
@@ -36,32 +36,32 @@ interface IoHandler extends FileInputStreamer, FileOutputStreamer {
        /**
         * Setter for the *real* file input instance
         *
-        * @param       $inputStream    The *real* file-input class
+        * @param       $inputStreamerInstance  The *real* file-input class
         * @return      void
         */
-       function setInputStream (FileInputStreamer $inputStream);
+       function setInputStreamerInstance (FileInputStreamer $inputStreamerInstance);
 
        /**
         * Getter for the *real* file input instance
         *
         * @return      $inputStream    The *real* file-input class
         */
-       function getInputStream ();
+       function getInputStreamerInstance ();
 
        /**
         * Setter for the *real* file output instance
         *
-        * @param       $outputStream   The *real* file-output class
+        * @param       $outputStreamerInstance         The *real* file-output class
         * @return      void
         */
-       function setOutputStream (FileOutputStreamer $outputStream);
+       function setOutputStreamerInstance (FileOutputStreamer $outputStreamerInstance);
 
        /**
         * Getter for the *real* file output instance
         *
         * @return      $outputStream   The *real* file-output class
         */
-       function getOutputStream ();
+       function getOutputStreamerInstance ();
 
        /**
         * Saves a file with data by using the current output stream
@@ -71,6 +71,6 @@ interface IoHandler extends FileInputStreamer, FileOutputStreamer {
         * @param       $objectInstance         An instance of a FrameworkInterface class (default: NULL)
         * @return      void
         */
-       function saveStreamToFile (SplFileInfo $infoInstance, $dataStream, FrameworkInterface $objectInstance = NULL);
+       function saveStreamToFile (SplFileInfo $infoInstance, string $dataStream, FrameworkInterface $objectInstance = NULL);
 
 }
index 257bb3fa4164c29e29d321d99219d599a4f21d64..f2cc311b8a67930d891ce64ffc366444bc2c869e 100644 (file)
@@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Middleware;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
+use Org\Mxchange\CoreFramework\Traits\Streamer\Output\OutputStreamerTrait;
 
 /**
  * An abstract middleware class for all other middlware classes
@@ -29,10 +29,8 @@ use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseMiddleware extends BaseFrameworkSystem {
-       /**
-        * The concrete output instance
-        */
-       private $outputInstance = NULL;
+       // Load traits
+       use OutputStreamerTrait;
 
        /**
         * Protected constructor
@@ -45,23 +43,4 @@ abstract class BaseMiddleware extends BaseFrameworkSystem {
                parent::__construct($className);
        }
 
-       /**
-        * Setter for output instance
-        *
-        * @param       $outputInstance The debug output instance
-        * @return      void
-        */
-       protected final function setOutputInstance (OutputStreamer $outputInstance) {
-               $this->outputInstance = $outputInstance;
-       }
-
-       /**
-        * Getter for output instance
-        *
-        * @return      $outputInstance The debug output instance
-        */
-       protected final function getOutputInstance () {
-               return $this->outputInstance;
-       }
-
 }
index 019411e384911538da221bfce1e394ff329a1125..d145b3bb72a36a3b469e9d1eaa9a3b1b1ce37a9a 100644 (file)
@@ -8,8 +8,8 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Handler\Stream\IoHandler;
 use Org\Mxchange\CoreFramework\Middleware\BaseMiddleware;
-use Org\Mxchange\CoreFramework\Stream\Filesystem\FileInputStreamer;
-use Org\Mxchange\CoreFramework\Stream\Filesystem\FileOutputStreamer;
+use Org\Mxchange\CoreFramework\Traits\Streamer\File\Input\FileInputStreamerTrait;
+use Org\Mxchange\CoreFramework\Traits\Streamer\File\Output\FileOutputStreamerTrait;
 
 // Import SPL stuff
 use \SplFileInfo;
@@ -38,15 +38,9 @@ use \SplFileInfo;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class FileIoHandler extends BaseMiddleware implements IoHandler {
-       /**
-        * The *real* file input class we shall use for reading data
-        */
-       private $inputStream = NULL;
-
-       /**
-        * The *real* file output class we shall use for reading data
-        */
-       private $outputStream = NULL;
+       // Load traits
+       use FileInputStreamerTrait;
+       use FileOutputStreamerTrait;
 
        /**
         * An instance of this class
@@ -77,8 +71,8 @@ class FileIoHandler extends BaseMiddleware implements IoHandler {
                $ioHandler = new FileIoHandler();
 
                // Set the *real* file IO instances (both the same)
-               $ioHandler->setInputStream(ObjectFactory::createObjectByConfiguredName('file_input_class'));
-               $ioHandler->setOutputStream(ObjectFactory::createObjectByConfiguredName('file_output_class'));
+               $ioHandler->setInputStreamerInstance(ObjectFactory::createObjectByConfiguredName('file_input_class'));
+               $ioHandler->setOutputStreamerInstance(ObjectFactory::createObjectByConfiguredName('file_output_class'));
 
                // Return instance
                return $ioHandler;
@@ -93,43 +87,6 @@ class FileIoHandler extends BaseMiddleware implements IoHandler {
                return self::$selfInstance;
        }
 
-       /**
-        * Setter for the *real* file input instance
-        *
-        * @param       $inputStream    The *real* file-input class
-        * @return      void
-        */
-       public final function setInputStream (FileInputStreamer $inputStream) {
-               $this->inputStream = $inputStream;
-       }
-
-       /**
-        * Getter for the *real* file input instance
-        *
-        * @return      $inputStream    The *real* file-input class
-        */
-       public final function getInputStream () {
-               return $this->inputStream;
-       }
-
-       /**
-        * Setter for the *real* file output instance
-        *
-        * @param       $outputStream   The *real* file-output class
-        * @return      void
-        */
-       public final function setOutputStream (FileOutputStreamer $outputStream) {
-               $this->outputStream = $outputStream;
-       }
-
-       /**
-        * Getter for the *real* file output instance
-        *
-        * @return      $outputStream   The *real* file-output class
-        */
-       public final function getOutputStream () {
-               return $this->outputStream;
-       }
        /**
         * Saves streamed (that are mostly serialized objects) data to files or
         * external servers.
@@ -152,7 +109,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler {
         * @param       $objectInstance         An instance of a FrameworkInterface class (default: NULL)
         * @return      void
         */
-       public function saveStreamToFile (SplFileInfo $infoInstance, $dataStream, FrameworkInterface $objectInstance = NULL) {
+       public function saveStreamToFile (SplFileInfo $infoInstance, string $dataStream, FrameworkInterface $objectInstance = NULL) {
                // Default is this array
                $className = $this->__toString();
 
@@ -169,7 +126,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler {
                );
 
                // Send the infoInstance and dataArray to the output handler
-               $this->getOutputStream()->saveFile($infoInstance, $dataArray);
+               $this->getOutputStreamerInstance()->saveFile($infoInstance, $dataArray);
        }
 
        /** Loads data from a file over the input handler
@@ -179,7 +136,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler {
         */
        public function loadFileContents (SplFileInfo $infoInstance) {
                // Read from the input handler
-               return $this->getInputStream()->loadFileContents($infoInstance);
+               return $this->getInputStreamerInstance()->loadFileContents($infoInstance);
        }
 
        /**
diff --git a/framework/main/traits/crypto/class_CryptoTrait.php b/framework/main/traits/crypto/class_CryptoTrait.php
new file mode 100644 (file)
index 0000000..1629c95
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Crypto;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Crypto\Cryptable;
+
+/**
+ * A trait for crypto classes
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait CryptoTrait {
+       /**
+        * Instance of a crypto helper
+        */
+       private $cryptoInstance = NULL;
+
+       /**
+        * Setter for Cryptable instance
+        *
+        * @param       $cryptoInstance An instance of a Cryptable class
+        * @return      void
+        */
+       protected final function setCryptoInstance (Cryptable $cryptoInstance) {
+               $this->cryptoInstance = $cryptoInstance;
+       }
+
+       /**
+        * Getter for Cryptable instance
+        *
+        * @return      $cryptoInstance An instance of a Cryptable class
+        */
+       public final function getCryptoInstance () {
+               return $this->cryptoInstance;
+       }
+
+}
diff --git a/framework/main/traits/manager/account/class_ManageableAccountTrait.php b/framework/main/traits/manager/account/class_ManageableAccountTrait.php
new file mode 100644 (file)
index 0000000..96b067d
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Manager\Account;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\User\ManageableAccount;
+
+/**
+ * A trait for manageable user/guest accounts
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait ManageableAccountTrait {
+       /**
+        * Instance for user class
+        * @todo Rename to $accountInstance ?
+        */
+       private $userInstance = NULL;
+
+       /**
+        * Protected setter for user instance
+        *
+        * @param       $userInstance   An instance of a user class
+        * @return      void
+        */
+       protected final function setUserInstance (ManageableAccount $userInstance) {
+               $this->userInstance = $userInstance;
+       }
+
+       /**
+        * Getter for user instance
+        *
+        * @return      $userInstance   An instance of a user class
+        */
+       public final function getUserInstance () {
+               return $this->userInstance;
+       }
+
+}
diff --git a/framework/main/traits/result/search/class_SearchableResultTrait.php b/framework/main/traits/result/search/class_SearchableResultTrait.php
new file mode 100644 (file)
index 0000000..59effe2
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Result\Search;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
+
+/**
+ * A trait for searchable results
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait SearchableResultTrait {
+       /**
+        * Database result instance
+        */
+       private $resultInstance = NULL;
+
+       /**
+        * Setter for database result instance
+        *
+        * @param       $resultInstance         An instance of a database result class
+        * @return      void
+        * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
+        */
+       protected final function setResultInstance (SearchableResult $resultInstance) {
+               $this->resultInstance =  $resultInstance;
+       }
+
+       /**
+        * Getter for database result instance
+        *
+        * @return      $resultInstance         An instance of a database result class
+        */
+       public final function getResultInstance () {
+               return $this->resultInstance;
+       }
+
+}
diff --git a/framework/main/traits/streamer/file/input/class_FileInputStreamerTrait.php b/framework/main/traits/streamer/file/input/class_FileInputStreamerTrait.php
new file mode 100644 (file)
index 0000000..0e0b7b5
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Streamer\File\Input;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stream\Filesystem\FileInputStreamer;
+
+/**
+ * Trait for file input streamer
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait FileInputStreamerTrait {
+       /**
+        * The *real* file input class we shall use for reading data
+        */
+       private $inputStreamerInstance = NULL;
+
+       /**
+        * Setter for the *real* file input instance
+        *
+        * @param       $inputStreamerInstance  The *real* file-input class
+        * @return      void
+        */
+       public final function setInputStreamerInstance (FileInputStreamer $inputStreamerInstance) {
+               $this->inputStreamerInstance = $inputStreamerInstance;
+       }
+
+       /**
+        * Getter for the *real* file input instance
+        *
+        * @return      $inputStreamerInstance  The *real* file-input class
+        */
+       public final function getInputStreamerInstance () {
+               return $this->inputStreamerInstance;
+       }
+
+}
diff --git a/framework/main/traits/streamer/file/output/class_FileOutputStreamerTrait.php b/framework/main/traits/streamer/file/output/class_FileOutputStreamerTrait.php
new file mode 100644 (file)
index 0000000..39b225f
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Streamer\File\Output;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stream\Filesystem\FileOutputStreamer;
+
+/**
+ * A trait for file output streamer
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait FileOutputStreamerTrait {
+       /**
+        * The *real* file output class we shall use for reading data
+        */
+       private $outputStreamerInstance = NULL;
+
+       /**
+        * Setter for the *real* file output instance
+        *
+        * @param       $outputStreamerInstance The *real* file-output class
+        * @return      void
+        */
+       public final function setOutputStreamerInstance (FileOutputStreamer $outputStreamerInstance) {
+               $this->outputStreamerInstance = $outputStreamerInstance;
+       }
+
+       /**
+        * Getter for the *real* file output instance
+        *
+        * @return      $outputStreamerInstance The *real* file-output class
+        */
+       public final function getOutputStreamerInstance () {
+               return $this->outputStreamerInstance;
+       }
+
+}
diff --git a/framework/main/traits/streamer/output/class_OutputStreamerTrait.php b/framework/main/traits/streamer/output/class_OutputStreamerTrait.php
new file mode 100644 (file)
index 0000000..9171cdc
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Streamer\Output;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
+
+/**
+ * A trait for output streamer instance
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait OutputStreamerTrait {
+       /**
+        * The concrete output instance
+        */
+       private $outputInstance = NULL;
+
+       /**
+        * Setter for output instance
+        *
+        * @param       $outputInstance The debug output instance
+        * @return      void
+        */
+       protected final function setOutputInstance (OutputStreamer $outputInstance) {
+               $this->outputInstance = $outputInstance;
+       }
+
+       /**
+        * Getter for output instance
+        *
+        * @return      $outputInstance The debug output instance
+        */
+       protected final function getOutputInstance () {
+               return $this->outputInstance;
+       }
+
+}