/** * リリースのステータスに応じたクラスを返します。 * * @param Article $article * @return string */ public function articleStatusClass($article) { $class = ''; $now = new \DateTime('now'); switch ($article->getStatus()) { case 'publish': $class = $article->getSendDate() <= $now ? 'active' : 'success'; break; case 'pending': $class = $article->getSendDate() <= $now ? 'danger' : 'warning'; break; } return $class; }