From 8712dc01df473aa6f63a8056593f4edb785d997a Mon Sep 17 00:00:00 2001 From: watermark Date: Tue, 11 Nov 2014 16:13:16 -0500 Subject: [PATCH] Cleanup of isUnique isUnique takes the count of the args multiple times. Store the count in a variable to cut down on overhead. --- lib/Cake/Model/Model.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 3952ad5c3..0848c0762 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -3315,9 +3315,10 @@ class Model extends Object implements CakeEventListener { } 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]); } }