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\Package; |
10
|
|
|
|
11
|
|
|
use Ticaje\BookingApi\Application\Repository\PackageRepositoryInterface; |
|
|
|
|
12
|
|
|
use Ticaje\BookingApi\Application\Signatures\Provider\Package\PackageProviderSignature; |
13
|
|
|
use Ticaje\Contract\Persistence\Entity\EntityInterface; |
14
|
|
|
use Ticaje\Contract\Persistence\Repository\RepositoryInterface as BaseRepositoryInterface; |
15
|
|
|
use Ticaje\Hexagonal\Application\Signatures\UseCase\UseCaseCommandInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class Package |
19
|
|
|
* @package Ticaje\BookingApi\Application\Service\Provider |
20
|
|
|
*/ |
21
|
|
|
class Package implements PackageProviderSignature |
22
|
|
|
{ |
23
|
|
|
/** @var PackageRepositoryInterface $circuitRepository */ |
24
|
|
|
private $circuitRepository; |
25
|
|
|
|
26
|
|
|
/** @var EntityInterface $circuit */ |
27
|
|
|
private $circuit; |
28
|
|
|
|
29
|
|
|
public function __construct( |
30
|
|
|
BaseRepositoryInterface $circuitRepository |
31
|
|
|
) { |
32
|
|
|
$this->circuitRepository = $circuitRepository; |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @inheritDoc |
37
|
|
|
*/ |
38
|
|
|
public function instance(UseCaseCommandInterface $command): PackageProviderSignature |
39
|
|
|
{ |
40
|
|
|
$productId = $command->getProductId(); |
|
|
|
|
41
|
|
|
$storeId = $command->getStoreId(); |
|
|
|
|
42
|
|
|
$this->circuit = $this->circuitRepository->getByProductAndStore($productId, $storeId); |
43
|
|
|
|
44
|
|
|
return $this; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @inheritDoc |
49
|
|
|
*/ |
50
|
|
|
public function getAvailability(int $from, int $to): bool |
51
|
|
|
{ |
52
|
|
|
// @todo implementation |
53
|
|
|
} |
|
|
|
|
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @inheritDoc |
57
|
|
|
*/ |
58
|
|
|
public function getDepartureDays(): array |
59
|
|
|
{ |
60
|
|
|
$result = unserialize($this->circuit->getDepartureDays()); |
|
|
|
|
61
|
|
|
|
62
|
|
|
return array_map(function ($value) { |
63
|
|
|
return $value - 1; |
64
|
|
|
}, $result); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @inheritDoc |
69
|
|
|
*/ |
70
|
|
|
public function getNumberOfNights(): int |
71
|
|
|
{ |
72
|
|
|
return (int)$this->circuit->getNumberOfNights(); |
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @inheritDoc |
77
|
|
|
*/ |
78
|
|
|
public function getDateTo(): string |
79
|
|
|
{ |
80
|
|
|
return $this->circuit->getDateTo(); |
|
|
|
|
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
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