diff --git a/src/CodeIQ/Greeter/Greeter.php b/src/CodeIQ/Greeter/Greeter.php index b13d32c..e623873 100644 --- a/src/CodeIQ/Greeter/Greeter.php +++ b/src/CodeIQ/Greeter/Greeter.php @@ -26,10 +26,19 @@ function __construct(Clock $clock) public function greet() { $currentTime = $this->clock->getCurrentTime(); - if ($currentTime >= new \DateTimeImmutable('05:00:00') && - $currentTime < new \DateTimeImmutable('12:00:00') + if ($this->timeIsMorning($currentTime) ) { return 'おはようございます'; } } + + /** + * @param $currentTime + * @return bool + */ + private function timeIsMorning($currentTime) + { + return $currentTime >= new \DateTimeImmutable('05:00:00') && + $currentTime < new \DateTimeImmutable('12:00:00'); + } }