Enhances method documentation in PreparedStatementConditionBuilder
authorMatthias Schmidt <gravatronics@live.com>
Thu, 9 Aug 2012 10:36:47 +0000 (12:36 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 9 Aug 2012 10:36:47 +0000 (12:36 +0200)
Also, `count` was replaced with `!empty`.

wcfsetup/install/files/lib/system/database/util/PreparedStatementConditionBuilder.class.php

index c66c6524f98b82d0256783ec321e98c77439b7ef..17ea88280a6e25b05f5c76131c3b4f9f97b8f392 100644 (file)
@@ -20,13 +20,13 @@ class PreparedStatementConditionBuilder extends ConditionBuilder {
        protected $parameters = array();
        
        /**
-        * Adds a new condition.
+        * Adds a new condition. The parameters array has to be a numbered array.
         * 
         * @param       string          $condition
         * @param       array           $parameters
         */
        public function add($condition, array $parameters = array()) {
-               if (count($parameters)) {
+               if (!empty($parameters)) {
                        $count = 0;
                        $callback = function ($matches) use (&$count, $parameters, $condition) {
                                if (!array_key_exists($count, $parameters)) {
@@ -50,7 +50,7 @@ class PreparedStatementConditionBuilder extends ConditionBuilder {
                $this->conditions .= $condition;
                
                // parameter handling
-               if (count($parameters)) {
+               if (!empty($parameters)) {
                        foreach ($parameters as $parameter) {
                                if (is_array($parameter)) {
                                        foreach ($parameter as $value) {