|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
/** |
|
4
|
|
|
* Application Service Class |
|
5
|
|
|
* @package Ticaje_BookingApi |
|
6
|
|
|
* @author Hector Luis Barrientos <[email protected]> |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Ticaje\BookingApi\Application\Service\Provider\AgencyCar; |
|
10
|
|
|
|
|
11
|
|
|
use Ticaje\BookingApi\Application\Repository\AssignedRepositoryInterface; |
|
|
|
|
|
|
12
|
|
|
use Ticaje\BookingApi\Application\Repository\DisabledRepositoryInterface; |
|
|
|
|
|
|
13
|
|
|
use Ticaje\BookingApi\Application\Signatures\Provider\ServiceProviderSignature; |
|
14
|
|
|
use Ticaje\Contract\Persistence\Repository\RepositoryInterface as BaseRepositoryInterface; |
|
15
|
|
|
use Ticaje\Hexagonal\Application\Signatures\UseCase\UseCaseCommandInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Class PickupLocation |
|
19
|
|
|
* @package Ticaje\BookingApi\Application\Service\Provider\AgencyCar |
|
20
|
|
|
*/ |
|
21
|
|
|
class PickupLocation implements ServiceProviderSignature |
|
22
|
|
|
{ |
|
23
|
|
|
/** @var AssignedRepositoryInterface $assignedRepository */ |
|
24
|
|
|
private $assignedRepository; |
|
25
|
|
|
|
|
26
|
|
|
/** @var DisabledRepositoryInterface $disabledRepository */ |
|
27
|
|
|
private $disabledRepository; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* PickupLocation constructor. |
|
31
|
|
|
* |
|
32
|
|
|
* @param BaseRepositoryInterface $assignedRepository |
|
33
|
|
|
* @param BaseRepositoryInterface $disabledRepository |
|
34
|
|
|
*/ |
|
35
|
|
|
public function __construct( |
|
36
|
|
|
BaseRepositoryInterface $assignedRepository, |
|
37
|
|
|
BaseRepositoryInterface $disabledRepository |
|
38
|
|
|
) { |
|
39
|
|
|
$this->assignedRepository = $assignedRepository; |
|
|
|
|
|
|
40
|
|
|
$this->disabledRepository = $disabledRepository; |
|
|
|
|
|
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @inheritDoc |
|
45
|
|
|
*/ |
|
46
|
|
|
public function execute(UseCaseCommandInterface $command) |
|
47
|
|
|
{ |
|
48
|
|
|
$result = []; |
|
49
|
|
|
$assigned = $this->assignedRepository->getAssignedForCar($command->getProductId()); |
|
|
|
|
|
|
50
|
|
|
foreach ($assigned as $item) { |
|
51
|
|
|
$disabled = $this->disabledRepository->getDisabledRulesForLocationAndCar($item->getId(), $command->getFromDate(), $command->getToDate()); |
|
|
|
|
|
|
52
|
|
|
if (count($disabled) > 0) { |
|
53
|
|
|
continue; |
|
54
|
|
|
} |
|
55
|
|
|
$result[$item->getId()] = $item; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return $result; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths