Changeset View
Changeset View
Standalone View
Standalone View
src/symbols/PhutilClassMapQuery.php
Context not available. | |||||
*/ | */ | ||||
private function loadMap() { | private function loadMap() { | ||||
$ancestor = $this->ancestorClass; | $ancestor = $this->ancestorClass; | ||||
if (!strlen($ancestor)) { | if (!@strlen($ancestor)) { | ||||
throw new PhutilInvalidStateException('setAncestorClass'); | throw new PhutilInvalidStateException('setAncestorClass'); | ||||
} | } | ||||
Context not available. | |||||
$unique = $this->uniqueMethod; | $unique = $this->uniqueMethod; | ||||
$sort = $this->sortMethod; | $sort = $this->sortMethod; | ||||
if (strlen($expand)) { | if (@strlen($expand)) { | ||||
if (!strlen($unique)) { | if (!@strlen($unique)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Trying to execute a class map query for descendants of class '. | 'Trying to execute a class map query for descendants of class '. | ||||
Context not available. | |||||
->loadObjects(); | ->loadObjects(); | ||||
// Apply the "expand" mechanism, if it is configured. | // Apply the "expand" mechanism, if it is configured. | ||||
if (strlen($expand)) { | if (@strlen($expand)) { | ||||
$list = array(); | $list = array(); | ||||
foreach ($objects as $object) { | foreach ($objects as $object) { | ||||
foreach (call_user_func(array($object, $expand)) as $instance) { | foreach (call_user_func(array($object, $expand)) as $instance) { | ||||
Context not available. | |||||
} | } | ||||
// Apply the "unique" mechanism, if it is configured. | // Apply the "unique" mechanism, if it is configured. | ||||
if (strlen($unique)) { | if (@strlen($unique)) { | ||||
$map = array(); | $map = array(); | ||||
foreach ($list as $object) { | foreach ($list as $object) { | ||||
$key = call_user_func(array($object, $unique)); | $key = call_user_func(array($object, $unique)); | ||||
Context not available. | |||||
} | } | ||||
// Apply the "filter" mechanism, if it is configured. | // Apply the "filter" mechanism, if it is configured. | ||||
if (strlen($filter)) { | if (@strlen($filter)) { | ||||
$map = mfilter($map, $filter); | $map = mfilter($map, $filter); | ||||
} | } | ||||
// Apply the "sort" mechanism, if it is configured. | // Apply the "sort" mechanism, if it is configured. | ||||
if (strlen($sort)) { | if (@strlen($sort)) { | ||||
if ($map) { | if ($map) { | ||||
// The "sort" method may return scalars (which we want to sort with | // The "sort" method may return scalars (which we want to sort with | ||||
// "msort()"), or may return PhutilSortVector objects (which we want | // "msort()"), or may return PhutilSortVector objects (which we want | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0