]> git.mxchange.org Git - core.git/blobdiff - framework/main/interfaces/criteria/class_Criteria.php
Continued:
[core.git] / framework / main / interfaces / criteria / class_Criteria.php
index 0506238f892d39dc5e1738695d12df6d6c7a04f3..0ff16acb4947eb43348377c789293525e4b5c36b 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 // Own namespace
-namespace CoreFramework\Criteria;
+namespace Org\Mxchange\CoreFramework\Criteria;
 
 // Import framework stuff
-use CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 
 /**
  * An interface for criterias
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -28,20 +28,25 @@ use CoreFramework\Generic\FrameworkInterface;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface Criteria extends FrameworkInterface {
+       // Criteria types
+       const CRITERIA_TYPE_DEFAULT  = 'default';
+       const CRITERIA_TYPE_CHOICE   = 'choice';
+       const CRITERIA_TYPE_EXCLUDE  = 'exclude';
+
        /**
-        * Setter for wrapper class name
+        * Setter for frontend class name
         *
-        * @param       $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
+        * @param       $frontendConfigEntry    Configuration entry which hold the frontend class' name
         * @return      void
         */
-       function setWrapperConfigEntry ($wrapperConfigEntry);
+       function setFrontendConfigEntry (string $frontendConfigEntry);
 
        /**
-        * Getter for wrapper class name
+        * Getter for Frontend class name
         *
-        * @return      $wrapperConfigEntry             Configuration entry which hold the wrapper class' name
+        * @return      $frontendConfigEntry    Configuration entry which hold the Frontend class' name
         */
-       function getWrapperConfigEntry ();
+       function getFrontendConfigEntry ();
 
        /**
         * Checks whether given key is set
@@ -50,7 +55,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaKey    Criteria key
         * @return      $isSet                  Whether key is set
         */
-       function isKeySet ($criteriaType, $criteriaKey);
+       function isKeySet (string $criteriaType, string $criteriaKey);
 
        /**
         * Checks whether given key is set for 'choice' type
@@ -58,7 +63,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaKey    Criteria key
         * @return      $isSet                  Whether key is set
         */
-       function isChoiceKeySet ($criteriaKey);
+       function isChoiceKeySet (string $criteriaKey);
 
        /**
         * Checks whether given key is set for 'exclude' type
@@ -66,7 +71,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaKey    Criteria key
         * @return      $isSet                  Whether key is set
         */
-       function isExcludeKeySet ($criteriaKey);
+       function isExcludeKeySet (string $criteriaKey);
 
        /**
         * Getter for criteria array
@@ -74,7 +79,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      $criteria
         */
-       function getCriteriaArray ($criteriaType = 'default');
+       function getCriteriaArray (string $criteriaType = 'default');
 
        /**
         * Getter for criteria array 'choice' type
@@ -96,7 +101,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaKey    Criteria key to unset
         * @return      void
         */
-       function unsetCriteria ($criteriaKey);
+       function unsetCriteria (string $criteriaKey);
 
        /**
         * Add criteria, this method converts dashes to underscores because dashes
@@ -107,7 +112,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      void
         */
-       function addCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default');
+       function addCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = 'default');
 
        /**
         * Sets criteria, this method converts dashes to underscores because dashes
@@ -118,7 +123,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      void
         */
-       function setCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default');
+       function setCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = 'default');
 
        /**
         * Add "choice" criteria, this method converts dashes to underscores because
@@ -128,7 +133,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaValue  Criteria value
         * @return      void
         */
-       function addChoiceCriteria ($criteriaKey, $criteriaValue);
+       function addChoiceCriteria (string $criteriaKey, $criteriaValue);
 
        /**
         * Add "exclude" criteria, this method converts dashes to underscores because
@@ -138,7 +143,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaValue  Criteria value
         * @return      void
         */
-       function addExcludeCriteria ($criteriaKey, $criteriaValue);
+       function addExcludeCriteria (string $criteriaKey, $criteriaValue);
 
        /**
         * Add configured criteria
@@ -148,32 +153,32 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      void
         */
-       function addConfiguredCriteria ($criteriaKey, $configEntry, $criteriaType = 'default');
+       function addConfiguredCriteria (string $criteriaKey, string $configEntry, string $criteriaType = 'default');
 
        /**
-        * Get criteria element or FALSE if not found
+        * Get criteria element or false if not found
         *
         * @param       $criteriaKey    The requested criteria key
         * @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
+        * @return      $value                  Whether the value of the critera or false
         */
-       function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default');
+       function getCriteriaElemnent (string $criteriaKey, string $criteriaType = 'default');
 
        /**
-        * Get criteria element or FALSE if not found for 'choice' type
+        * Get criteria element or false if not found for 'choice' type
         *
         * @param       $criteriaKey    The requested criteria key
-        * @return      $value                  Whether the value of the critera or FALSE
+        * @return      $value                  Whether the value of the critera or false
         */
-       function getCriteriaChoiceElemnent ($criteriaKey);
+       function getCriteriaChoiceElemnent (string $criteriaKey);
 
        /**
-        * Get criteria element or FALSE if not found for 'exclude' type
+        * Get criteria element or false if not found for 'exclude' type
         *
         * @param       $criteriaKey    The requested criteria key
-        * @return      $value                  Whether the value of the critera or FALSE
+        * @return      $value                  Whether the value of the critera or false
         */
-       function getCriteriaExcludeElemnent ($criteriaKey);
+       function getCriteriaExcludeElemnent (string $criteriaKey);
 
        /**
         * Checks whether given array entry matches
@@ -182,7 +187,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      $matches                Whether the entry matches or not
         */
-       function ifEntryMatches (array $entryArray, $criteriaType = 'default');
+       function ifEntryMatches (array $entryArray, string $criteriaType = 'default');
 
        /**
         * Checks whether given array 'choice' entry matches
@@ -207,7 +212,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
         * @return      $cacheKey       The key suitable for the cache system
         */
-       function getCacheKey ($onlyKeys = array(), $criteriaType = 'default');
+       function getCacheKey (array $onlyKeys = [], string $criteriaType = 'default');
 
        /**
         * "Getter" for a cache key ('choice' type)
@@ -215,7 +220,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $onlyKeys       Only use these keys for a cache key
         * @return      $cacheKey       The key suitable for the cache system
         */
-       function getCacheKeyChoice ($onlyKeys = array());
+       function getCacheKeyChoice (array $onlyKeys = []);
 
        /**
         * "Getter" for a cache key ('exclude' type)
@@ -223,16 +228,7 @@ interface Criteria extends FrameworkInterface {
         * @param       $onlyKeys       Only use these keys for a cache key
         * @return      $cacheKey       The key suitable for the cache system
         */
-       function getCacheKeyExclude ($onlyKeys = array());
-
-       /**
-        * Count the criteria, e.g. useful to find out if a database query has no
-        * limitation (search criteria).
-        *
-        * @param       $criteriaType   Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
-        * @return      $count  Count of all criteria entries
-        */
-       function count ($criteriaType = 'default');
+       function getCacheKeyExclude (array $onlyKeys = []);
 
        /**
         * Count 'choice' criteria, e.g. useful to find out if a database query