Changed static to self calls
This commit is contained in:
@@ -16,15 +16,25 @@ class Object {
|
||||
* @param string Object Key that we are evaluating
|
||||
* @param string Value for that Key
|
||||
* @param array The array of objects
|
||||
* @param boolean Traverse children
|
||||
* @return boolean
|
||||
*/
|
||||
public static function in_array($key,$value,array $objects) {
|
||||
public static function in_array($key,$value,array $objects,$traverse=FALSE) {
|
||||
if (! count($objects))
|
||||
return FALSE;
|
||||
|
||||
foreach ($objects as $object)
|
||||
foreach ($objects as $object) {
|
||||
if (is_array($object)) {
|
||||
if (! $traverse)
|
||||
continue;
|
||||
|
||||
if (self::in_array($key,$value,$object,$traverse))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (isset($object->$key) AND $object->$key == $value)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user