3 namespace Org\Mxchange\CoreFramework\Criteria;
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
9 * An interface for criterias
11 * @author Roland Haeder <webmaster@shipsimu.org>
13 <<<<<<< HEAD:framework/main/interfaces/criteria/class_Criteria.php
14 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
16 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
17 >>>>>>> Some updates::inc/main/interfaces/criteria/class_Criteria.php
18 * @license GNU GPL 3.0 or any newer version
19 * @link http://www.shipsimu.org
21 * This program is free software: you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation, either version 3 of the License, or
24 * (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program. If not, see <http://www.gnu.org/licenses/>.
34 interface Criteria extends FrameworkInterface {
36 * Setter for wrapper class name
38 * @param $wrapperConfigEntry Configuration entry which hold the wrapper class' name
41 function setWrapperConfigEntry ($wrapperConfigEntry);
44 * Getter for wrapper class name
46 * @return $wrapperConfigEntry Configuration entry which hold the wrapper class' name
48 function getWrapperConfigEntry ();
51 * Checks whether given key is set
53 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
54 * @param $criteriaKey Criteria key
55 * @return $isSet Whether key is set
57 function isKeySet ($criteriaType, $criteriaKey);
60 * Checks whether given key is set for 'choice' type
62 * @param $criteriaKey Criteria key
63 * @return $isSet Whether key is set
65 function isChoiceKeySet ($criteriaKey);
68 * Checks whether given key is set for 'exclude' type
70 * @param $criteriaKey Criteria key
71 * @return $isSet Whether key is set
73 function isExcludeKeySet ($criteriaKey);
76 * Getter for criteria array
78 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
81 function getCriteriaArray ($criteriaType = 'default');
84 * Getter for criteria array 'choice' type
88 function getCriteriaChoiceArray ();
91 * Getter for criteria array 'exclude' type
95 function getCriteriaExcludeArray ();
98 * Unsets a criteria key from all criteria types
100 * @param $criteriaKey Criteria key to unset
103 function unsetCriteria ($criteriaKey);
106 * Add criteria, this method converts dashes to underscores because dashes
107 * are not valid for criteria keys.
109 * @param $criteriaKey Criteria key
110 * @param $criteriaValue Criteria value
111 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
114 function addCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default');
117 * Sets criteria, this method converts dashes to underscores because dashes
118 * are not valid for criteria keys.
120 * @param $criteriaKey Criteria key
121 * @param $criteriaValue Criteria value
122 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
125 function setCriteria ($criteriaKey, $criteriaValue, $criteriaType = 'default');
128 * Add "choice" criteria, this method converts dashes to underscores because
129 * dashes are not valid for criteria keys.
131 * @param $criteriaKey Criteria key
132 * @param $criteriaValue Criteria value
135 function addChoiceCriteria ($criteriaKey, $criteriaValue);
138 * Add "exclude" criteria, this method converts dashes to underscores because
139 * dashes are not valid for criteria keys.
141 * @param $criteriaKey Criteria key
142 * @param $criteriaValue Criteria value
145 function addExcludeCriteria ($criteriaKey, $criteriaValue);
148 * Add configured criteria
150 * @param $criteriaKey Criteria key
151 * @param $configEntry Configuration entry
152 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
155 function addConfiguredCriteria ($criteriaKey, $configEntry, $criteriaType = 'default');
158 * Get criteria element or false if not found
160 * @param $criteriaKey The requested criteria key
161 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
162 * @return $value Whether the value of the critera or false
164 function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default');
167 * Get criteria element or false if not found for 'choice' type
169 * @param $criteriaKey The requested criteria key
170 * @return $value Whether the value of the critera or false
172 function getCriteriaChoiceElemnent ($criteriaKey);
175 * Get criteria element or false if not found for 'exclude' type
177 * @param $criteriaKey The requested criteria key
178 * @return $value Whether the value of the critera or false
180 function getCriteriaExcludeElemnent ($criteriaKey);
183 * Checks whether given array entry matches
185 * @param $entryArray Array with the entries to find
186 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
187 * @return $matches Whether the entry matches or not
189 function ifEntryMatches (array $entryArray, $criteriaType = 'default');
192 * Checks whether given array 'choice' entry matches
194 * @param $entryArray Array with the entries to find
195 * @return $matches Whether the entry matches or not
197 function ifChoiceMatches (array $entryArray);
200 * Checks whether given array 'exclude' entry matches
202 * @param $entryArray Array with the entries to find
203 * @return $matches Whether the entry matches or not
205 function ifExcludeMatches (array $entryArray);
208 * "Getter" for a cache key
210 * @param $onlyKeys Only use these keys for a cache key
211 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
212 * @return $cacheKey The key suitable for the cache system
214 function getCacheKey ($onlyKeys = array(), $criteriaType = 'default');
217 * "Getter" for a cache key ('choice' type)
219 * @param $onlyKeys Only use these keys for a cache key
220 * @return $cacheKey The key suitable for the cache system
222 function getCacheKeyChoice ($onlyKeys = array());
225 * "Getter" for a cache key ('exclude' type)
227 * @param $onlyKeys Only use these keys for a cache key
228 * @return $cacheKey The key suitable for the cache system
230 function getCacheKeyExclude ($onlyKeys = array());
233 * Count the criteria, e.g. useful to find out if a database query has no
234 * limitation (search criteria).
236 * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude'
237 * @return $count Count of all criteria entries
239 function count ($criteriaType = 'default');
242 * Count 'choice' criteria, e.g. useful to find out if a database query
243 * has no limitation (search criteria).
245 * @return $count Count of all criteria entries
247 function countChoice ();
250 * Count 'exclude' criteria, e.g. useful to find out if a database query
251 * has no limitation (search criteria).
253 * @return $count Count of all criteria entries
255 function countExclude ();