Skip to content
Permalink
Browse files

Cleanup of isUnique

isUnique takes the count of the args multiple times.  Store the count in a variable to cut down on overhead.
  • Loading branch information...
watermark committed Nov 11, 2014
1 parent 2990c21 commit 8712dc01df473aa6f63a8056593f4edb785d997a
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/Cake/Model/Model.php
@@ -3315,9 +3315,10 @@ public function isUnique($fields, $or = true) {
}
if (!is_array($fields)) {
$fields = func_get_args();
if (is_bool($fields[count($fields) - 1])) {
$or = $fields[count($fields) - 1];
unset($fields[count($fields) - 1]);
$fieldCount = count($fields) - 1;
if (is_bool($fields[$fieldCount])) {
$or = $fields[$fieldCount];
unset($fields[$fieldCount]);
}
}

0 comments on commit 8712dc0

Please sign in to comment.
You can’t perform that action at this time.