Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 24 Nov 2020 02:23:38 +0000 (03:23 +0100)
committerRoland Häder <roland@mxchange.org>
Tue, 24 Nov 2020 02:23:38 +0000 (03:23 +0100)
- moved $searchInstance + getter/setter from monolithic BaseFrameworkSystem to
  proper classes/interfaces
- moved interfaces in own sub directories and not "extended"

Signed-off-by: Roland Häder <roland@mxchange.org>
20 files changed:
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/criteria/dataset/class_DataSetCriteria.php
framework/main/classes/criteria/update/class_UpdateCriteria.php
framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php
framework/main/classes/database/frontend/class_UserDatabaseWrapper.php
framework/main/classes/database/frontend/class_UserPointsDatabaseWrapper.php
framework/main/classes/database/result/class_CachedDatabaseResult.php
framework/main/classes/points/class_UserPoints.php
framework/main/classes/user/class_BaseUser.php
framework/main/interfaces/criteria/add/class_AddableCriteria.php [new file with mode: 0644]
framework/main/interfaces/criteria/extended/class_AddableCriteria.php [deleted file]
framework/main/interfaces/criteria/extended/class_LocalSearchCriteria.php [deleted file]
framework/main/interfaces/criteria/extended/class_LocalUpdateCriteria.php [deleted file]
framework/main/interfaces/criteria/extended/class_StoreableCriteria.php [deleted file]
framework/main/interfaces/criteria/search/class_LocalSearchCriteria.php [new file with mode: 0644]
framework/main/interfaces/criteria/store/class_StoreableCriteria.php [new file with mode: 0644]
framework/main/interfaces/criteria/update/class_LocalUpdateCriteria.php [new file with mode: 0644]
framework/main/interfaces/database/class_Updateable.php
framework/main/interfaces/database/wrapper/class_BookablePointsWrapper.php
framework/main/interfaces/database/wrapper/class_ManageableAccountWrapper.php

index 0cfc19bb40e37307ca2940a7703c7fb80b4fd785..91af004ff3d4f14ee47cd58aad482b75f0de8e6b 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\Criteria\Local\LocalSearchCriteria;
 use Org\Mxchange\CoreFramework\Crypto\Cryptable;
 use Org\Mxchange\CoreFramework\Database\Frontend\DatabaseWrapper;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
@@ -77,11 +76,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         */
        private $realClass = __CLASS__;
 
-       /**
-        * Search criteria instance
-        */
-       private $searchInstance = NULL;
-
        /**
         * Database result instance
         */
@@ -478,25 +472,6 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
                return $this->resultInstance;
        }
 
-       /**
-        * Setter for search instance
-        *
-        * @param       $searchInstance         Searchable criteria instance
-        * @return      void
-        */
-       public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
-               $this->searchInstance = $searchInstance;
-       }
-
-       /**
-        * Getter for search instance
-        *
-        * @return      $searchInstance         Searchable criteria instance
-        */
-       public final function getSearchInstance () {
-               return $this->searchInstance;
-       }
-
        /**
         * Setter for debug instance
         *
index b68b36f15927f1e8ac95fb1eaefb149e85f5f92c..0547f50135e4616e7b6e4da7c9daf789edc35b23 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Criteria\DataSet;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Criteria\BaseCriteria;
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
 use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 
@@ -48,7 +49,12 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
        /**
         * Primary keys
         */
-       private $primaryKeys = array();
+       private $primaryKeys = [];
+
+       /**
+        * Search criteria instance
+        */
+       private $searchInstance = NULL;
 
        /**
         * Protected constructor
@@ -66,7 +72,7 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
         * @param       $tableName                      Name of the table
         * @return      $criteriaInstance       An instance of this criteria
         */
-       public static final function createDataSetCriteria ($tableName) {
+       public static final function createDataSetCriteria (string $tableName) {
                // Get a new instance
                $criteriaInstance = new DataSetCriteria();
 
@@ -83,8 +89,8 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
         * @param       $tableName      Name of the table to set
         * @return      void
         */
-       public final function setTableName ($tableName) {
-               $this->tableName = (string) $tableName;
+       public final function setTableName (string $tableName) {
+               $this->tableName = $tableName;
        }
 
        /**
@@ -102,8 +108,8 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
         * @param       $uniqueKey      Column to use as unique key
         * @return      void
         */
-       public final function setUniqueKey ($uniqueKey) {
-               $this->uniqueKey = (string) $uniqueKey;
+       public final function setUniqueKey (string $uniqueKey) {
+               $this->uniqueKey = $uniqueKey;
        }
 
        /**
@@ -115,6 +121,55 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
                return $this->uniqueKey;
        }
 
+       /**
+        * Setter for primary key
+        *
+        * @param       $primaryKey             Primary key to set
+        * @return      void
+        */
+       public final function setPrimaryKey (string $primaryKey) {
+               $this->primaryKey = $primaryKey;
+       }
+
+       /**
+        * Setter for primary key array
+        *
+        * @param       $primaryKeys    Primary key array to set
+        * @return      void
+        */
+       public function setPrimaryKeyCombined (array $primaryKeys) {
+               $this->primaryKeys = $primaryKeys;
+       }
+
+       /**
+        * Getter for primary keys
+        *
+        * @return      $primaryKeys    Primary key array
+        */
+       public final function getPrimaryKeys () {
+               // Return it
+               return $this->primaryKeys;
+       }
+
+       /**
+        * Setter for search instance
+        *
+        * @param       $searchInstance         Searchable criteria instance
+        * @return      void
+        */
+       public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
+               $this->searchInstance = $searchInstance;
+       }
+
+       /**
+        * Getter for search instance
+        *
+        * @return      $searchInstance         Searchable criteria instance
+        */
+       public final function getSearchInstance () {
+               return $this->searchInstance;
+       }
+
        /**
         * Getter for unique key value
         *
@@ -193,34 +248,4 @@ class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
                return $primaryKey;
        }
 
-       /**
-        * Setter for primary key
-        *
-        * @param       $primaryKey             Primary key to set
-        * @return      void
-        */
-       public final function setPrimaryKey ($primaryKey) {
-               $this->primaryKey = (string) $primaryKey;
-       }
-
-       /**
-        * Setter for primary key array
-        *
-        * @param       $primaryKeys    Primary key array to set
-        * @return      void
-        */
-       public function setPrimaryKeyCombined (array $primaryKeys) {
-               $this->primaryKeys = $primaryKeys;
-       }
-
-       /**
-        * Getter for primary keys
-        *
-        * @return      $primaryKeys    Primary key array
-        */
-       public final function getPrimaryKeys () {
-               // Return it
-               return $this->primaryKeys;
-       }
-
 }
index 3de687150cf33a1d3158c2e16b67b3e5c2dbe993..06b947c49cf74b644dba03e2eeba0fa4fecda4a4 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Mxchange\CoreFramework\Criteria\Update;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Criteria\BaseCriteria;
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
 use Org\Mxchange\CoreFramework\Criteria\Local\LocalUpdateCriteria;
 
 /**
@@ -31,6 +32,11 @@ use Org\Mxchange\CoreFramework\Criteria\Local\LocalUpdateCriteria;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class UpdateCriteria extends BaseCriteria implements LocalUpdateCriteria {
+       /**
+        * Search criteria instance
+        */
+       private $searchInstance = NULL;
+
        /**
         * Protected constructor
         *
@@ -63,4 +69,23 @@ class UpdateCriteria extends BaseCriteria implements LocalUpdateCriteria {
                return $this->getCriteriaArray();
        }
 
+       /**
+        * Setter for search instance
+        *
+        * @param       $searchInstance         Searchable criteria instance
+        * @return      void
+        */
+       public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
+               $this->searchInstance = $searchInstance;
+       }
+
+       /**
+        * Getter for search instance
+        *
+        * @return      $searchInstance         Searchable criteria instance
+        */
+       public final function getSearchInstance () {
+               return $this->searchInstance;
+       }
+
 }
index 7ba7a968b31ddeed72f742697abf7ad053ea390d..1171aab931d593e1e3f666dd2721999c12611156 100644 (file)
@@ -563,7 +563,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
        /**
         * "Updates" a data set instance with a database layer
         *
-        * @param       $dataSetInstance        A storeable data set
+        * @param       $dataSetInstance        An instance of a StorableCriteria class
         * @return      void
         * @throws      SqlException    If an SQL error occurs
         */
index c24a66e665728549022dc7cf511d9c42861ba33c..f729abebdaf19274430f4b348194b165d116b68e 100644 (file)
@@ -97,7 +97,7 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper implements ManageableAccou
        /**
         * Updates an user database entry with given result
         *
-        * @param       $resultInstance         An instance of a Updateable database result
+        * @param       $resultInstance         An instance of a UpdateableResult class
         * @return      void
         * @throws      NullPointerException    If $updateInstance or $searchInstance is null
         */
index dc013e70bac392428f0888337c4d03df86a6e069..096cb90ea3bd4545d712c84193774e269150eef1 100644 (file)
@@ -96,7 +96,7 @@ class UserPointsDatabaseWrapper extends BaseDatabaseWrapper implements BookableP
        /**
         * Updates an user database entry with given result
         *
-        * @param       $resultInstance         An instance of a Updateable database result
+        * @param       $resultInstance         An instance of a UpdateableResult class
         * @return      void
         */
        public function doUpdateByResult (UpdateableResult $resultInstance) {
index 9f08757ba7d1dbdd85a93c4e0f7ea2695cf4d542..9aca86df5613256623880e0919c3c8346c653246 100644 (file)
@@ -277,16 +277,16 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
         * Adds an update request to the database result for writing it to the
         * database layer
         *
-        * @param       $criteriaInstance       An instance of a updateable criteria
+        * @param       $updateInstance An instance of a updateable criteria
         * @return      void
         * @throws      ResultUpdateException   If no result was updated
         */
-       public function add2UpdateQueue (LocalUpdateCriteria $criteriaInstance) {
+       public function add2UpdateQueue (LocalUpdateCriteria $updateInstance) {
                // Rewind the pointer
                $this->rewind();
 
                // Get search criteria
-               $searchInstance = $criteriaInstance->getSearchInstance();
+               $searchInstance = $updateInstance->getSearchInstance();
 
                // And start looking for the result
                $foundEntries = $this->getAffectedRows();
@@ -298,7 +298,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                        // Is this entry found?
                        if ($searchInstance->ifEntryMatches($currentEntry)) {
                                // Update this entry
-                               $this->updateCurrentEntryByCriteria($criteriaInstance);
+                               $this->updateCurrentEntryByCriteria($updateInstance);
 
                                // Count one up
                                $foundEntries++;
@@ -315,7 +315,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
                $this->setAffectedRows($foundEntries);
 
                // Set update instance
-               $this->setUpdateInstance($criteriaInstance);
+               $this->setUpdateInstance($updateInstance);
        }
 
        /**
index 0d9c329d1964f8eecc6a73539288738d666957ee..b07858dbcb5e6d83dcaa21f2f45a2ea5364b1172 100644 (file)
@@ -147,10 +147,10 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
                // Do we have an entry?
                if ($this->getResultInstance()->next()) {
                        // Get the entry
-                       $entry = $this->getResultInstance()->current();
+                       $currentEntry = $this->getResultInstance()->current();
 
                        // Add the points
-                       $amount += $entry[UserPointsDatabaseWrapper::DB_COLUMN_POINTS];
+                       $amount += $currentEntry[UserPointsDatabaseWrapper::DB_COLUMN_POINTS];
 
                        // Now get another criteria
                        $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
index 1d58dcd2170a24dda78a488e205e74f5d29e26cc..36791ab5770ebf67e48662bf76dddc518f07d491 100644 (file)
@@ -320,7 +320,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @return      void
         * @todo        Try to make this method more generic so we can move it in BaseFrameworkSystem
         */
-       public function updateDatabaseField ($fieldName, $fieldValue) {
+       public function updateDatabaseField (string $fieldName, $fieldValue) {
                // Get a critieria instance
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
diff --git a/framework/main/interfaces/criteria/add/class_AddableCriteria.php b/framework/main/interfaces/criteria/add/class_AddableCriteria.php
new file mode 100644 (file)
index 0000000..c771576
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Criteria\Add;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+
+/**
+ * An interface for classes which are allowed to add criteria
+ *
+ * @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/>.
+ */
+interface AddableCriteria extends FrameworkInterface {
+       /**
+        * Adds registration elements to a given dataset instance
+        *
+        * @param       $criteriaInstance       An instance of a StoreableCriteria class
+        * @return      void
+        */
+       function addElementsToDataSet (StoreableCriteria $criteriaInstance);
+
+}
diff --git a/framework/main/interfaces/criteria/extended/class_AddableCriteria.php b/framework/main/interfaces/criteria/extended/class_AddableCriteria.php
deleted file mode 100644 (file)
index c771576..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Criteria\Add;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
-use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
-
-/**
- * An interface for classes which are allowed to add criteria
- *
- * @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/>.
- */
-interface AddableCriteria extends FrameworkInterface {
-       /**
-        * Adds registration elements to a given dataset instance
-        *
-        * @param       $criteriaInstance       An instance of a StoreableCriteria class
-        * @return      void
-        */
-       function addElementsToDataSet (StoreableCriteria $criteriaInstance);
-
-}
diff --git a/framework/main/interfaces/criteria/extended/class_LocalSearchCriteria.php b/framework/main/interfaces/criteria/extended/class_LocalSearchCriteria.php
deleted file mode 100644 (file)
index 1272c20..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Criteria\Local;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Criteria\Criteria;
-
-/**
- * An interface for local criterias
- *
- * @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/>.
- */
-interface LocalSearchCriteria extends Criteria {
-       /**
-        * Setter for limit
-        *
-        * @param       $limit  Search limit
-        * @return      void
-        * @todo        Find a nice casting here. (int) allows until and including 32766.
-        */
-       function setLimit ($limit);
-
-       /**
-        * "Setter" for limit from a configuration entry
-        *
-        * @param       $configEntry    The configuration entry which hold a number as limit
-        * @return      void
-        */
-       function setConfiguredLimit ($configEntry);
-
-       /**
-        * Getter for limit
-        *
-        * @return      $limit  Search limit
-        */
-       function getLimit ();
-
-       /**
-        * Setter for skip
-        *
-        * @param       $skip   Search skip
-        * @return      void
-        * @todo        Find a nice casting here. (int) allows until and including 32766.
-        */
-       function setSkip ($skip);
-
-       /**
-        * Getter for skip
-        *
-        * @return      $skip   Search skip
-        */
-       function getSkip ();
-
-       /**
-        * Checks whether the given key/value pair is matching with 'default' and one of 'choice' and
-        * never with in 'exclude'.
-        *
-        * @param       $key                    Key element to check
-        * @param       $value                  Value to check
-        * @param       $separator              Separator for "exploding" $value (default: ',')
-        * @return      $isMatching             Whether the key/value is matching or excluded
-        */
-       function isCriteriaMatching ($key, $value, $separator = ',');
-
-}
diff --git a/framework/main/interfaces/criteria/extended/class_LocalUpdateCriteria.php b/framework/main/interfaces/criteria/extended/class_LocalUpdateCriteria.php
deleted file mode 100644 (file)
index 78edf3f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Criteria\Local;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Criteria\Criteria;
-
-/**
- * An interface for local criterias
- *
- * @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/>.
- */
-interface LocalUpdateCriteria extends Criteria {
-
-}
diff --git a/framework/main/interfaces/criteria/extended/class_StoreableCriteria.php b/framework/main/interfaces/criteria/extended/class_StoreableCriteria.php
deleted file mode 100644 (file)
index b056662..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Criteria\Storing;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Criteria\Criteria;
-
-/**
- * An interface for storeable data sets
- *
- * @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/>.
- */
-interface StoreableCriteria extends Criteria {
-       /**
-        * Setter for table name
-        *
-        * @param       $tableName      Name of the table to set
-        * @return      void
-        */
-       function setTableName ($tableName);
-
-       /**
-        * Getter for table name
-        *
-        * @return      $tableName      Name of the table to set
-        */
-       function getTableName ();
-
-       /**
-        * Setter for unique key
-        *
-        * @param       $uniqueKey      Column to use as unique key
-        * @return      void
-        */
-       function setUniqueKey ($uniqueKey);
-
-       /**
-        * Getter for unique key
-        *
-        * @return      $uniqueKey      Column to use as unique key
-        */
-       function getUniqueKey ();
-
-       /**
-        * Getter for unique key value
-        *
-        * @return      $uniqueValue    Value of the unique key
-        */
-       function getUniqueValue ();
-
-       /**
-        * Getter for primary key or unique key if not set
-        *
-        * @return      $primaryKey             Primary key or unique key if not set
-        */
-       function getPrimaryKey ();
-
-       /**
-        * Setter for primary key
-        *
-        * @param       $primaryKey             Primary key to set
-        * @return      void
-        */
-       function setPrimaryKey ($primaryKey);
-
-       /**
-        * Setter for primary key array
-        *
-        * @param       $primaryKeys    Primary key array to set
-        * @return      void
-        */
-       function setPrimaryKeyCombined (array $primaryKeys);
-
-       /**
-        * Getter for primary keys
-        *
-        * @return      $primaryKeys    Primary key array
-        */
-       function getPrimaryKeys ();
-
-}
diff --git a/framework/main/interfaces/criteria/search/class_LocalSearchCriteria.php b/framework/main/interfaces/criteria/search/class_LocalSearchCriteria.php
new file mode 100644 (file)
index 0000000..1272c20
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Criteria\Local;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Criteria\Criteria;
+
+/**
+ * An interface for local criterias
+ *
+ * @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/>.
+ */
+interface LocalSearchCriteria extends Criteria {
+       /**
+        * Setter for limit
+        *
+        * @param       $limit  Search limit
+        * @return      void
+        * @todo        Find a nice casting here. (int) allows until and including 32766.
+        */
+       function setLimit ($limit);
+
+       /**
+        * "Setter" for limit from a configuration entry
+        *
+        * @param       $configEntry    The configuration entry which hold a number as limit
+        * @return      void
+        */
+       function setConfiguredLimit ($configEntry);
+
+       /**
+        * Getter for limit
+        *
+        * @return      $limit  Search limit
+        */
+       function getLimit ();
+
+       /**
+        * Setter for skip
+        *
+        * @param       $skip   Search skip
+        * @return      void
+        * @todo        Find a nice casting here. (int) allows until and including 32766.
+        */
+       function setSkip ($skip);
+
+       /**
+        * Getter for skip
+        *
+        * @return      $skip   Search skip
+        */
+       function getSkip ();
+
+       /**
+        * Checks whether the given key/value pair is matching with 'default' and one of 'choice' and
+        * never with in 'exclude'.
+        *
+        * @param       $key                    Key element to check
+        * @param       $value                  Value to check
+        * @param       $separator              Separator for "exploding" $value (default: ',')
+        * @return      $isMatching             Whether the key/value is matching or excluded
+        */
+       function isCriteriaMatching ($key, $value, $separator = ',');
+
+}
diff --git a/framework/main/interfaces/criteria/store/class_StoreableCriteria.php b/framework/main/interfaces/criteria/store/class_StoreableCriteria.php
new file mode 100644 (file)
index 0000000..948a309
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Criteria\Storing;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Criteria\Criteria;
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
+
+/**
+ * An interface for storeable data sets
+ *
+ * @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/>.
+ */
+interface StoreableCriteria extends Criteria {
+       /**
+        * Setter for table name
+        *
+        * @param       $tableName      Name of the table to set
+        * @return      void
+        */
+       function setTableName (string $tableName);
+
+       /**
+        * Getter for table name
+        *
+        * @return      $tableName      Name of the table to set
+        */
+       function getTableName ();
+
+       /**
+        * Setter for unique key
+        *
+        * @param       $uniqueKey      Column to use as unique key
+        * @return      void
+        */
+       function setUniqueKey (string $uniqueKey);
+
+       /**
+        * Getter for unique key
+        *
+        * @return      $uniqueKey      Column to use as unique key
+        */
+       function getUniqueKey ();
+
+       /**
+        * Setter for primary key
+        *
+        * @param       $primaryKey             Primary key to set
+        * @return      void
+        */
+       function setPrimaryKey (string $primaryKey);
+
+       /**
+        * Setter for primary key array
+        *
+        * @param       $primaryKeys    Primary key array to set
+        * @return      void
+        */
+       public function setPrimaryKeyCombined (array $primaryKeys);
+
+       /**
+        * Getter for primary keys
+        *
+        * @return      $primaryKeys    Primary key array
+        */
+       function getPrimaryKeys ();
+
+       /**
+        * Setter for search instance
+        *
+        * @param       $searchInstance         Searchable criteria instance
+        * @return      void
+        */
+       function setSearchInstance (LocalSearchCriteria $searchInstance);
+
+       /**
+        * Getter for search instance
+        *
+        * @return      $searchInstance         Searchable criteria instance
+        */
+       function getSearchInstance ();
+
+       /**
+        * Getter for unique key value
+        *
+        * @return      $uniqueValue    Value of the unique key
+        */
+       function getUniqueValue ();
+
+       /**
+        * Getter for primary key or unique key if not set
+        *
+        * @return      $primaryKey             Primary key or unique key if not set
+        */
+       function getPrimaryKey ();
+
+}
diff --git a/framework/main/interfaces/criteria/update/class_LocalUpdateCriteria.php b/framework/main/interfaces/criteria/update/class_LocalUpdateCriteria.php
new file mode 100644 (file)
index 0000000..1c332a3
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Criteria\Local;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Criteria\Criteria;
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
+
+/**
+ * An interface for local criterias
+ *
+ * @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/>.
+ */
+interface LocalUpdateCriteria extends Criteria {
+       /**
+        * Getter for update criteria array
+        *
+        * @return      $updateCriteria         Array holding the update criteria
+        */
+       function getUpdateCriteria ();
+
+       /**
+        * Setter for search instance
+        *
+        * @param       $searchInstance         Searchable criteria instance
+        * @return      void
+        */
+       function setSearchInstance (LocalSearchCriteria $searchInstance);
+
+       /**
+        * Getter for search instance
+        *
+        * @return      $searchInstance         Searchable criteria instance
+        */
+       function getSearchInstance ();
+
+}
index 6fd756a159098a1006b456136dcf1a66ed5ce0cd..a502e087292ec152176256a66d67c508219b70ea 100644 (file)
@@ -35,6 +35,6 @@ interface Updateable extends FrameworkInterface {
         * @param       $fieldValue             New value to store
         * @return      void
         */
-       function updateDatabaseField ($fieldName, $fieldValue);
+       function updateDatabaseField (string $fieldName, $fieldValue);
 
 }
index 51d96dcea9da4adbbd8886828cb93604b36a7f4f..a1c65263af7b89dfa3e1d5f990bb35f26ad03c81 100644 (file)
@@ -40,7 +40,7 @@ interface BookablePointsWrapper extends DatabaseWrapper {
        /**
         * Updates an user database entry with given result
         *
-        * @param       $resultInstance         An instance of a Updateable database result
+        * @param       $resultInstance         An instance of a UpdateableResult class
         * @return      void
         */
        function doUpdateByResult (UpdateableResult $resultInstance);
index 556c9811e166fb40dd960e4caabff7b556814c45..e22a5c5bca99236fe1cfd78a440803d698f55564 100644 (file)
@@ -41,7 +41,7 @@ interface ManageableAccountWrapper extends DatabaseWrapper {
        /**
         * Updates an user database entry with given result
         *
-        * @param       $resultInstance         An instance of a Updateable database result
+        * @param       $resultInstance         An instance of a UpdateableResult class
         * @return      void
         */
        function doUpdateByResult (UpdateableResult $resultInstance);