GetAttemptsForDoor.php 788 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace Source\UseCases\Attempts\GetAttemptsForDoor;

use Carbon\Carbon;
use Source\Gateways\Attempts\AttemptsRepository;

class GetAttemptsForDoor implements GetAttemptsForDoorUseCase
{
    /**
     * @var \Source\Gateways\Attempts\AttemptsRepository
     */
    protected AttemptsRepository $attempts;

    public function __construct(AttemptsRepository $attempts)
    {
        $this->attempts = $attempts;
    }

    /**
     * @inheritDoc
     */
    public function getAttemptsForDoorBetween(string $doorId, string $begin, string $end, Presenter $presenter): void
    {
        $attempts = $this->attempts->getForDoorBetween($doorId, new Carbon($begin), new Carbon($end));

        $response = new ResponseModel($attempts);

        $presenter->present($response);
    }
}