From b4232edcfd07f120a69897418c9aa12cbc219805 Mon Sep 17 00:00:00 2001 From: Antonio Mora Rives Date: Mon, 27 Jun 2022 08:50:39 +0200 Subject: [PATCH] fix: :bug: fixed undefined array key "honey_time" error #33 #59 --- src/Checks/MinimumTimePassedCheck.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Checks/MinimumTimePassedCheck.php b/src/Checks/MinimumTimePassedCheck.php index 52bbeb0..5a4d5ab 100644 --- a/src/Checks/MinimumTimePassedCheck.php +++ b/src/Checks/MinimumTimePassedCheck.php @@ -9,8 +9,21 @@ class MinimumTimePassedCheck implements Check { + protected $data; + + protected function missingFromData() + { + return !$this->data->offsetExists(Honey::inputs()->getTimeOfPageLoadInputName()); + } + public function passes($data) { + $this->data = collect($data); + + if ($this->missingFromData()) { + return false; + } + $value = $data[Honey::inputs()->getTimeOfPageLoadInputName()]; return rescue(fn() => Values::timeOfPageLoad()->checkValue($value)); }