public function comment(Analyse $analysis)
 {
     $statement = "INSERT INTO comment (title, text, datetime, username, analysis_id) \r\n            VALUES (:title, :text, :datetime, :username, :analysis)";
     $query = $this->session->prepare($statement);
     $comment = $analysis->getComments()->offsetGet($analysis->getComments()->count() - 1);
     $query->bindParam(":title", $comment->title());
     $query->bindParam(":text", $comment->text());
     $query->bindParam(":datetime", $comment->dateTime());
     $query->bindParam(":username", $comment->getWritterUsername());
     $query->bindParam(":analysis", $comment->getAnalysisId());
     $query->execute();
     return $query->rowCount() == 1;
 }
 public static function printAnalysis(Analyse $publication)
 {
     $html = "<li>";
     $html .= "<span class='date-publication'>[";
     $html .= $publication->getDateFormatted();
     $html .= "]</span>";
     $html .= "<a target='_blank' href='" . LinkController::getBaseURL() . "/analise/" . $publication->link() . ".html'>";
     $html .= $publication->title();
     $html .= "</a><br />";
     $qtdComments = $publication->getComments()->count();
     $html .= "<span class='number-comments'>";
     $html .= $qtdComments . ' ' . ($qtdComments == 1 ? "comentário" : "comentários");
     $html .= "</span>";
     $html .= "</li>";
     echo $html;
 }