1]; $helps = $helpRepo->findAll($params); $result = []; if ($helps->count() > 0) { $result = $this->handleHelps($helps); } return $result; } /** * @param HelpModel[] $helps * @return array */ protected function handleHelps($helps) { $items = []; foreach ($helps as $help) { $items[] = [ 'id' => $help->id, 'title' => $help->title, 'content' => $help->content, ]; } return $items; } }