/** * Formats a list of builds into rows suitable for the dropdowns in the PHPCI header bar. * @param $builds * @return array */ protected function formatBuilds($builds) { Project::$sleepable = array('id', 'title', 'reference', 'type'); $rtn = array('count' => $builds['count'], 'items' => array()); foreach ($builds['items'] as $build) { $item = $build->toArray(1); $header = new b8\View('Build/header-row'); $header->build = $build; $item['header_row'] = $header->render(); $rtn['items'][$item['id']] = $item; } ksort($rtn['items']); return $rtn; }