public function getArticleStats($ids) { $ids = (array) $ids; if (empty($ids)) { return array(); } $stats = array(); foreach ($ids as $id) { $stats[$id] = array('normal' => 0, 'recommended' => 0); } foreach (array('normal' => false, 'recommended' => true) as $key => $recommended) { $rows = $this->getCommentCounts($ids, $recommended); foreach ($rows as $row) { $stats[(int) $row['article_num']][$key] = (int) $row[1]; } } $ce_rows = $this->getCommentsEnabled($ids); foreach ($ce_rows as $row) { $stats[(int) $row['number']]['comments_enabled'] = (bool) $row['comments_enabled']; } return $stats; }