]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/criteria/class_BaseCriteria.php
Made lower to upper case:
[core.git] / inc / classes / main / criteria / class_BaseCriteria.php
index d02c32fca8d75024538929a1fde57d7fec5c93d1..cbf192d36e31d567475985f926681e1978eacda4 100644 (file)
@@ -137,6 +137,26 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                return $this->getCriteriaArray('exclude');
        }
 
+       /**
+        * Unsets a criteria key from all criteria types
+        *
+        * @param       $criteriaKey    Criteria key to unset
+        * @return      void
+        */
+       public final function unsetCriteria ($criteriaKey) {
+               // Make sure no 'my-' or 'my_' passes this point
+               assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE));
+
+               // Convert dashes to underscore
+               $criteriaKey = $this->convertDashesToUnderscores($criteriaKey);
+
+               // "Walk" through all criterias
+               foreach ($this->criteria as $criteriaType => $dummy) {
+                       // Remove it
+                       unset($this->criteria[$criteriaType][$criteriaKey]);
+               } // END - foreach
+       }
+
        /**
         * Add criteria, this method converts dashes to underscores because dashes
         * are not valid for criteria keys.
@@ -182,7 +202,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($criteriaType) . '(' . $this->__toString() . ')-CRITERIA[' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue);
 
                // Add it
-               $this->criteria['choice'][$this->convertDashesToUnderscores($criteriaKey)][] = (string) $criteriaValue;
+               array_push($this->criteria['choice'][$this->convertDashesToUnderscores($criteriaKey)], (string) $criteriaValue);
        }
 
        /**
@@ -273,7 +293,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         */
        public function ifEntryMatches (array $entryArray, $criteriaType = 'default') {
                // First nothing matches and nothing is counted
-               $matches = false;
+               $matches = FALSE;
                $counted = 0;
 
                // Walk through all entries