/** * @param $array * @return mixed */ private function processGraph($array) { if (!is_array($array)) { return null; } $output = array(); foreach ($array as $key => $group) { if (is_array($group)) { foreach ($group as $item) { if (is_array($item) && array_key_exists('peerindex_id', $item)) { $output[$key][] = Actor::getInstance($item); } } } } return $output; }