Skip to content

Commit 24a8a99

Browse files
committed
Merge pull request #286 from Luke-j/Luke-j-patch-1
Changed inc() and dec() methods to support float
2 parents 16d88ae + 25baa59 commit 24a8a99

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

MysqliDb.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,18 +1280,24 @@ public function now ($diff = null, $func = "NOW()") {
12801280

12811281
/**
12821282
* Method generates incremental function call
1283-
* @param int increment amount. 1 by default
1283+
* @param int increment by int or float. 1 by default
12841284
*/
12851285
public function inc($num = 1) {
1286-
return Array ("[I]" => "+" . (int)$num);
1286+
if(!is_numeric($num)){
1287+
trigger_error('Argument supplied to inc must be a number', E_USER_ERROR);
1288+
}
1289+
return Array ("[I]" => "+" . $num);
12871290
}
12881291

12891292
/**
12901293
* Method generates decrimental function call
1291-
* @param int increment amount. 1 by default
1294+
* @param int increment by int or float. 1 by default
12921295
*/
12931296
public function dec ($num = 1) {
1294-
return Array ("[I]" => "-" . (int)$num);
1297+
if(!is_numeric($num)){
1298+
trigger_error('Argument supplied to dec must be a number', E_USER_ERROR);
1299+
}
1300+
return Array ("[I]" => "-" . $num);
12951301
}
12961302

12971303
/**

0 commit comments

Comments
 (0)