summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch <[email protected]>2014-06-23 22:15:02 +1000
committerMitch <[email protected]>2014-06-23 22:15:02 +1000
commit2600268f6cb0d6d4ec4252a63e72b66e920e242b (patch)
tree044b08be479e5582458dddbdd0d144adcef74375
parent91e8e2c936a16ed3e2e3ff3c27f9d4d7eaedaa2f (diff)
Swap switch for if/else
-rw-r--r--idiorm.php24
1 files changed, 8 insertions, 16 deletions
diff --git a/idiorm.php b/idiorm.php
index 6ef5911..80e9a4d 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -413,22 +413,14 @@
$time = microtime(true);
foreach ($parameters as $key => &$param) {
- switch (true) {
- case is_null($param):
- $type = PDO::PARAM_NULL;
- break;
-
- case is_bool($param):
- $type = PDO::PARAM_BOOL;
- break;
-
- case is_int($param):
- $type = PDO::PARAM_INT;
- break;
-
- default:
- $type = PDO::PARAM_STR;
- break;
+ if (is_null($param)) {
+ $type = PDO::PARAM_NULL;
+ } else if (is_bool($param)) {
+ $type = PDO::PARAM_BOOL;
+ } else if (is_int($param)) {
+ $type = PDO::PARAM_INT;
+ } else {
+ $type = PDO::PARAM_STR;
}
$statement->bindParam(is_int($key) ? ++$key : $key, $param, $type);