Added type-hint 'array' for $onlyKeys because this should only be an array.
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 255a7f614352ed8c6580a2e32019da200a248296..79a60abeb3d09d1622ad580dfb3acf70541c9191 100644 (file)
@@ -361,8 +361,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                } elseif (is_array($args)) {
                        // Some arguments are there
                        foreach ($args as $arg) {
-                               // Add the type
-                               $argsString .= $this->replaceControlCharacters($arg) . ' (' . gettype($arg);
+                               // Add the value itself if not array. This prevents 'array to string conversion' message
+                               if (is_array($arg)) {
+                                       $argsString .= 'Array';
+                               } else {
+                                       $argsString .= $arg;
+                               }
+
+                               // Add data about the argument
+                               $argsString .= ' (' . gettype($arg);
 
                                if (is_string($arg)) {
                                        // Add length for strings
@@ -726,11 +733,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Checks wether an object equals this object. You should overwrite this
+        * Checks whether an object equals this object. You should overwrite this
         * method to implement own equality checks
         *
         * @param       $objectInstance         An instance of a FrameworkInterface object
-        * @return      $equals                         Wether both objects equals
+        * @return      $equals                         Whether both objects equals
         */
        public function equals (FrameworkInterface $objectInstance) {
                // Now test it
@@ -982,10 +989,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Outputs a debug message wether to debug instance (should be set!) or dies with or pints the message
+        * Outputs a debug message whether to debug instance (should be set!) or dies with or pints the message
         *
         * @param       $message        Message we shall send out...
-        * @param       $doPrint        Wether we shall print or die here which first is the default
+        * @param       $doPrint        Whether we shall print or die here which first is the default
         * @return      void
         */
        public function debugOutput ($message, $doPrint = true) {
@@ -1311,10 +1318,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Checks wether the given PHP extension is loaded
+        * Checks whether the given PHP extension is loaded
         *
         * @param       $phpExtension   The PHP extension we shall check
-        * @return      $isLoaded       Wether the PHP extension is loaded
+        * @return      $isLoaded       Whether the PHP extension is loaded
         */
        public final function isPhpExtensionLoaded ($phpExtension) {
                // Is it loaded?
@@ -1398,7 +1405,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Idles (sleeps) for given milliseconds
         *
-        * @return      $hasSlept       Wether it goes fine
+        * @return      $hasSlept       Whether it goes fine
         */
        public function idle ($milliSeconds) {
                // Sleep is fine by default
@@ -1899,10 +1906,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Checks wether the given encoded data was encoded with Base64
+        * Checks whether the given encoded data was encoded with Base64
         *
         * @param       $encodedData    Encoded data we shall check
-        * @return      $isBase64               Wether the encoded data is Base64
+        * @return      $isBase64               Whether the encoded data is Base64
         */
        protected function isBase64Encoded ($encodedData) {
                // Determine it
@@ -1938,7 +1945,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @param       $onlyKeys                       Only use these keys for a cache key
         * @return      $cacheKey                       A cache key suitable for lookup/storage purposes
         */
-       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, $onlyKeys = array()) {
+       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) {
                // Generate it
                $cacheKey = sprintf("%s@%s",
                        $this->__toString(),
@@ -2007,8 +2014,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $ret = (double) $ret;
                } // END - if
 
-               // Has the whole value changed?
-               assert(($assertMismatch === true) && ('' . $ret . '' != '' . $num . '') && (!is_null($num)));
+               // Assert only if requested
+               if ($assertMismatch === true) {
+                       // Has the whole value changed?
+                       assert(('' . $ret . '' != '' . $num . '') && (!is_null($num)));
+               } // END - if
 
                // Return result
                return $ret;