BasicResourceService.php
102 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Services\Resource; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Collection\Collection; |
| 6 | use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException; |
| 7 | use AmeliaBooking\Domain\Entity\Bookable\Service\Service; |
| 8 | use AmeliaBooking\Domain\Services\Interval\IntervalService; |
| 9 | use AmeliaBooking\Domain\Services\Schedule\ScheduleService; |
| 10 | |
| 11 | /** |
| 12 | * Class BasicResourceService |
| 13 | * |
| 14 | * @package AmeliaBooking\Domain\Services\Resource |
| 15 | */ |
| 16 | class BasicResourceService extends AbstractResourceService |
| 17 | { |
| 18 | /** |
| 19 | * BasicResourceService constructor. |
| 20 | * |
| 21 | * @param IntervalService $intervalService |
| 22 | * @param ScheduleService $scheduleService |
| 23 | */ |
| 24 | public function __construct( |
| 25 | $intervalService, |
| 26 | $scheduleService |
| 27 | ) { |
| 28 | $this->intervalService = $intervalService; |
| 29 | |
| 30 | $this->scheduleService = $scheduleService; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * set substitute resources instead of resources that are not shred between services/locations |
| 35 | * |
| 36 | * @param Collection $resources |
| 37 | * @param array $entitiesIds |
| 38 | * @param int $serviceId |
| 39 | * |
| 40 | * @return void |
| 41 | * @throws InvalidArgumentException |
| 42 | */ |
| 43 | public function setNonSharedResources($resources, $entitiesIds, $serviceId) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * get collection of resources for service |
| 49 | * |
| 50 | * @param Collection $resources |
| 51 | * @param int $serviceId |
| 52 | * |
| 53 | * @return Collection |
| 54 | * @throws InvalidArgumentException |
| 55 | */ |
| 56 | public function getServiceResources($resources, $serviceId) |
| 57 | { |
| 58 | return new Collection(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * get providers id values for resources |
| 63 | * |
| 64 | * @param Collection $resources |
| 65 | * |
| 66 | * @return array |
| 67 | */ |
| 68 | public function getResourcesProvidersIds($resources) |
| 69 | { |
| 70 | return []; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * set unavailable intervals (fake appointments) to providers in moments when resources are used up |
| 75 | * return intervals of resources with locations that are used up |
| 76 | * |
| 77 | * @param Collection $resources |
| 78 | * @param Collection $appointments |
| 79 | * @param Collection $allLocations |
| 80 | * @param Service $service |
| 81 | * @param Collection $providers |
| 82 | * @param int|null $locationId |
| 83 | * @param int|null $excludeAppointmentId |
| 84 | * @param int $personsCount |
| 85 | * |
| 86 | * @return array |
| 87 | * @throws InvalidArgumentException |
| 88 | */ |
| 89 | public function manageResources( |
| 90 | $resources, |
| 91 | $appointments, |
| 92 | $allLocations, |
| 93 | $service, |
| 94 | $providers, |
| 95 | $locationId, |
| 96 | $excludeAppointmentId, |
| 97 | $personsCount |
| 98 | ) { |
| 99 | return []; |
| 100 | } |
| 101 | } |
| 102 |