mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-29 20:59:23 +02:00
Replace DataObject->isNotNull() helper with closure
Now possible since we support PHP 5.3+ only.
This commit is contained in:
parent
0650dbe1e7
commit
5a94e621c5
@ -2568,7 +2568,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
$results = $this->extend($methodName, $member);
|
$results = $this->extend($methodName, $member);
|
||||||
if($results && is_array($results)) {
|
if($results && is_array($results)) {
|
||||||
// Remove NULLs
|
// Remove NULLs
|
||||||
$results = array_filter($results, array($this,'isNotNull'));
|
$results = array_filter($results, function($v) {return !is_null($v);});
|
||||||
// If there are any non-NULL responses, then return the lowest one of them.
|
// If there are any non-NULL responses, then return the lowest one of them.
|
||||||
// If any explicitly deny the permission, then we don't get access
|
// If any explicitly deny the permission, then we don't get access
|
||||||
if($results) return min($results);
|
if($results) return min($results);
|
||||||
@ -2576,16 +2576,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper functon for extendedCan
|
|
||||||
*
|
|
||||||
* @param Mixed $value
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
private function isNotNull($value) {
|
|
||||||
return !is_null($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Member $member
|
* @param Member $member
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
Loading…
Reference in New Issue
Block a user