*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 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
*
* 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
* @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
* @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
* @param $criteriaKey Criteria key
* @return $isSet Whether key is set
*/
- function isExcludeKeySet ($criteriaKey);
+ function isExcludeKeySet (string $criteriaKey);
/**
* Getter for criteria array
* @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
* @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
* @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
* @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
* @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
* @param $criteriaValue Criteria value
* @return void
*/
- function addExcludeCriteria ($criteriaKey, $criteriaValue);
+ function addExcludeCriteria (string $criteriaKey, $criteriaValue);
/**
* Add configured criteria
* @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
* @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
*/
- function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default');
+ function getCriteriaElemnent (string $criteriaKey, string $criteriaType = 'default');
/**
* 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
*/
- function getCriteriaChoiceElemnent ($criteriaKey);
+ function getCriteriaChoiceElemnent (string $criteriaKey);
/**
* 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
*/
- function getCriteriaExcludeElemnent ($criteriaKey);
+ function getCriteriaExcludeElemnent (string $criteriaKey);
/**
* Checks whether given array entry matches
* @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
* @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)
* @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)
* @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