]> git.mxchange.org Git - core.git/commitdiff
Added assert() + commented in debug lines
authorRoland Häder <roland@mxchange.org>
Sat, 19 Oct 2013 15:06:43 +0000 (15:06 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 19 Oct 2013 15:06:43 +0000 (15:06 +0000)
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/criteria/class_BaseCriteria.php
inc/classes/main/database/class_BaseDatabaseWrapper.php

index 4207299b8f159ec5852ecb81d219a4882193d8d8..6c06b03f2e3998734207e99e29776bb5824eb7b3 100644 (file)
@@ -2017,7 +2017,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) {
                // Generate it
         */
        protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) {
                // Generate it
-               $cacheKey = sprintf("%s@%s",
+               $cacheKey = sprintf('%s@%s',
                        $this->__toString(),
                        $criteriaInstance->getCacheKey($onlyKeys)
                );
                        $this->__toString(),
                        $criteriaInstance->getCacheKey($onlyKeys)
                );
index 929b048f9c84815ab6edcc17e4fad281bbc30fa5..9e1be5b05980271290263e806eb673ef01845f20 100644 (file)
@@ -358,6 +358,8 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
                        // Make sure no 'my-' or 'my_' passes this point
                        assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue)));
                foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
                        // Make sure no 'my-' or 'my_' passes this point
                        assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue)));
+
+                       // $criteriaValue cannot be an array
                        assert(!is_array($criteriaValue));
 
                        // Convert dashes to underscore
                        assert(!is_array($criteriaValue));
 
                        // Convert dashes to underscore
@@ -366,7 +368,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                        // Is the value in array or is $onlyKeys empty?
                        if ((isset($onlyKeys[$criteriaKey])) || (count($onlyKeys) == 0)) {
                                // Add the value URL encoded to avoid any trouble with special characters
                        // Is the value in array or is $onlyKeys empty?
                        if ((isset($onlyKeys[$criteriaKey])) || (count($onlyKeys) == 0)) {
                                // Add the value URL encoded to avoid any trouble with special characters
-                               $cacheKey .= sprintf("%s=%s;",
+                               $cacheKey .= sprintf('%s=%s;',
                                        $criteriaKey,
                                        urlencode($criteriaValue)
                                );
                                        $criteriaKey,
                                        urlencode($criteriaValue)
                                );
@@ -381,7 +383,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
                        // Check if 'limit' and 'skip' are in
                        if (((isset($onlyKeys['limit'])) && (isset($onlyKeys['skip']))) || (count($onlyKeys) == 0)) {
                                // Add limit and skip values
                        // Check if 'limit' and 'skip' are in
                        if (((isset($onlyKeys['limit'])) && (isset($onlyKeys['skip']))) || (count($onlyKeys) == 0)) {
                                // Add limit and skip values
-                               $cacheKey .= sprintf(";%%limit%%=%s;%%skip%%=%s",
+                               $cacheKey .= sprintf(';%%limit%%=%s;%%skip%%=%s',
                                        $this->getLimit(),
                                        $this->getSkip()
                                );
                                        $this->getLimit(),
                                        $this->getSkip()
                                );
index 65c4445b4e323ee122174b8177cbe96c778c7f91..d507f2c3897e2d0d8e6b4415b3dbbeb765670257 100644 (file)
@@ -151,13 +151,13 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem {
                // Does this key exists in cache?
                if ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1)) {
                        // Debug message
                // Does this key exists in cache?
                if ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1)) {
                        // Debug message
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Cache used for cacheKey=' . $cacheKey . ':' . print_r($this->cacheInstance->offsetGet($cacheKey), TRUE));
+                       /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Cache used for cacheKey=' . $cacheKey . ':' . print_r($this->cacheInstance->offsetGet($cacheKey), TRUE));
 
                        // Then use this result
                        $result = $this->cacheInstance->offsetGet($cacheKey);
                } else {
                        // Debug message
 
                        // Then use this result
                        $result = $this->cacheInstance->offsetGet($cacheKey);
                } else {
                        // Debug message
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Quering database, cacheKey=' . $cacheKey);
+                       /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Quering database, cacheKey=' . $cacheKey);
 
                        // Now it's time to ask the database layer for this select statement
                        $result = $this->getDatabaseInstance()->doSelectByTableCriteria($this->getTableName(), $criteriaInstance);
 
                        // Now it's time to ask the database layer for this select statement
                        $result = $this->getDatabaseInstance()->doSelectByTableCriteria($this->getTableName(), $criteriaInstance);