From c2434cfedcd88d729408ebfffc868d064260cbf1 Mon Sep 17 00:00:00 2001 From: aymm Date: Sat, 27 Mar 2021 20:36:32 +0100 Subject: [PATCH] Added canVote() to poll --- src/Entities/Poll.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Entities/Poll.php b/src/Entities/Poll.php index ac4e9d9..4121464 100644 --- a/src/Entities/Poll.php +++ b/src/Entities/Poll.php @@ -125,8 +125,12 @@ class Poll public function canVote() { $is_authenticated = $this->api->isAuthenticated(false, true); - $is_closed = $this->closed_at <= new \DateTime(); - return $is_authenticated && !$is_closed; + return $is_authenticated && !$this->isClosed(); + } + + public function isClosed() + { + return $this->closed_at <= new \DateTime(); } public function __toString(): string