application.services.php
1 month ago
command.bus.php
2 years ago
container.php
4 weeks ago
domain.event.bus.php
1 year ago
domain.services.php
1 year ago
infrastructure.services.php
4 months ago
infrastructure.user.php
1 year ago
repositories.php
6 months ago
request.php
4 weeks ago
application.services.php
590 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Assembling application services: |
| 5 | * Instantiating application services and injecting the Infrastructure layer implementations |
| 6 | */ |
| 7 | |
| 8 | use AmeliaBooking\Application\Services\Bookable\AbstractPackageApplicationService; |
| 9 | use AmeliaBooking\Application\Services\Bookable\BookableApplicationService; |
| 10 | use AmeliaBooking\Application\Services\Booking\AppointmentApplicationService; |
| 11 | use AmeliaBooking\Application\Services\Booking\BookingApplicationService; |
| 12 | use AmeliaBooking\Application\Services\Booking\EventApplicationService; |
| 13 | use AmeliaBooking\Application\Services\Calendar\CalendarProviderService; |
| 14 | use AmeliaBooking\Application\Services\Cache\CacheApplicationService; |
| 15 | use AmeliaBooking\Application\Services\Entity\EntityApplicationService; |
| 16 | use AmeliaBooking\Application\Services\Gallery\GalleryApplicationService; |
| 17 | use AmeliaBooking\Application\Services\Payment\PaymentApplicationService; |
| 18 | use AmeliaBooking\Application\Services\Reservation\ReservationService; |
| 19 | use AmeliaBooking\Application\Services\TimeSlot\TimeSlotService; |
| 20 | use AmeliaBooking\Application\Services\WaitingList\WaitingListService; |
| 21 | use AmeliaBooking\Application\Services\User\CustomerApplicationService; |
| 22 | use AmeliaBooking\Application\Services\User\ProviderApplicationService; |
| 23 | use AmeliaBooking\Application\Services\User\UserApplicationService; |
| 24 | use AmeliaBooking\Domain\Entity\Booking\Reservation; |
| 25 | use AmeliaBooking\Infrastructure\Common\Container; |
| 26 | |
| 27 | defined('ABSPATH') or die('No script kiddies please!'); |
| 28 | |
| 29 | /** |
| 30 | * Entities service |
| 31 | * |
| 32 | * @param Container $c |
| 33 | * |
| 34 | * @return EntityApplicationService |
| 35 | */ |
| 36 | $entries['application.entity.service'] = function ($c) { |
| 37 | return new AmeliaBooking\Application\Services\Entity\EntityApplicationService($c); |
| 38 | }; |
| 39 | |
| 40 | /** |
| 41 | * Customer service |
| 42 | * |
| 43 | * @param Container $c |
| 44 | * |
| 45 | * @return UserApplicationService |
| 46 | */ |
| 47 | $entries['application.user.service'] = function ($c) { |
| 48 | return new AmeliaBooking\Application\Services\User\UserApplicationService($c); |
| 49 | }; |
| 50 | |
| 51 | /** |
| 52 | * API User Application service |
| 53 | * |
| 54 | * @param $c |
| 55 | * |
| 56 | * @return AmeliaBooking\Application\Services\User\UserApplicationService |
| 57 | */ |
| 58 | $entries['application.api.user.service'] = function ($c) { |
| 59 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getApiService( |
| 60 | $c |
| 61 | ); |
| 62 | }; |
| 63 | |
| 64 | /** |
| 65 | * Provider service |
| 66 | * |
| 67 | * @param Container $c |
| 68 | * |
| 69 | * @return ProviderApplicationService |
| 70 | */ |
| 71 | $entries['application.user.provider.service'] = function ($c) { |
| 72 | return new AmeliaBooking\Application\Services\User\ProviderApplicationService($c); |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * Customer service |
| 77 | * |
| 78 | * @param Container $c |
| 79 | * |
| 80 | * @return CustomerApplicationService |
| 81 | */ |
| 82 | $entries['application.user.customer.service'] = function ($c) { |
| 83 | return new AmeliaBooking\Application\Services\User\CustomerApplicationService($c); |
| 84 | }; |
| 85 | |
| 86 | /** |
| 87 | * Current Location Service |
| 88 | * |
| 89 | * @return AmeliaBooking\Application\Services\Location\AbstractCurrentLocation |
| 90 | */ |
| 91 | $entries['application.currentLocation.service'] = function () { |
| 92 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getCurrentLocationService(); |
| 93 | }; |
| 94 | |
| 95 | /** |
| 96 | * Deposit Service |
| 97 | * |
| 98 | * @param Container $c |
| 99 | * |
| 100 | * @return AmeliaBooking\Application\Services\Deposit\AbstractDepositApplicationService |
| 101 | */ |
| 102 | $entries['application.deposit.service'] = function ($c) { |
| 103 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getDepositService($c); |
| 104 | }; |
| 105 | |
| 106 | /** |
| 107 | * Extra Service |
| 108 | * |
| 109 | * @param Container $c |
| 110 | * |
| 111 | * @return AmeliaBooking\Application\Services\Extra\AbstractExtraApplicationService |
| 112 | */ |
| 113 | $entries['application.extra.service'] = function ($c) { |
| 114 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getExtraService($c); |
| 115 | }; |
| 116 | |
| 117 | /** |
| 118 | * Appointment service |
| 119 | * |
| 120 | * @param Container $c |
| 121 | * |
| 122 | * @return AppointmentApplicationService |
| 123 | */ |
| 124 | $entries['application.booking.appointment.service'] = function ($c) { |
| 125 | return new AmeliaBooking\Application\Services\Booking\AppointmentApplicationService($c); |
| 126 | }; |
| 127 | |
| 128 | /** |
| 129 | * Event service |
| 130 | * |
| 131 | * @param Container $c |
| 132 | * |
| 133 | * @return EventApplicationService |
| 134 | */ |
| 135 | $entries['application.booking.event.service'] = function ($c) { |
| 136 | return new AmeliaBooking\Application\Services\Booking\EventApplicationService($c); |
| 137 | }; |
| 138 | |
| 139 | /** |
| 140 | * Reservation service |
| 141 | * |
| 142 | * @param Container $c |
| 143 | * |
| 144 | * @return ReservationService |
| 145 | */ |
| 146 | $entries['application.reservation.service'] = function ($c) { |
| 147 | return new AmeliaBooking\Application\Services\Reservation\ReservationService($c); |
| 148 | }; |
| 149 | |
| 150 | /** |
| 151 | * Reservation |
| 152 | * |
| 153 | * @param bool $validate |
| 154 | * |
| 155 | * @return Reservation |
| 156 | */ |
| 157 | $entries['application.reservation'] = function () { |
| 158 | return new AmeliaBooking\Domain\Entity\Booking\Reservation(); |
| 159 | }; |
| 160 | |
| 161 | /** |
| 162 | * Appointment Reservation service |
| 163 | * |
| 164 | * @param Container $c |
| 165 | * |
| 166 | * @return AmeliaBooking\Application\Services\Reservation\AppointmentReservationService |
| 167 | */ |
| 168 | $entries['application.reservation.appointment.service'] = function ($c) { |
| 169 | return new AmeliaBooking\Application\Services\Reservation\AppointmentReservationService($c); |
| 170 | }; |
| 171 | |
| 172 | /** |
| 173 | * Package Reservation service |
| 174 | * |
| 175 | * @param Container $c |
| 176 | * |
| 177 | * @return AmeliaBooking\Application\Services\Reservation\PackageReservationService |
| 178 | */ |
| 179 | $entries['application.reservation.package.service'] = function ($c) { |
| 180 | return new AmeliaBooking\Application\Services\Reservation\PackageReservationService($c); |
| 181 | }; |
| 182 | |
| 183 | /** |
| 184 | * Event Reservation service |
| 185 | * |
| 186 | * @param Container $c |
| 187 | * |
| 188 | * @return AmeliaBooking\Application\Services\Reservation\EventReservationService |
| 189 | */ |
| 190 | $entries['application.reservation.event.service'] = function ($c) { |
| 191 | return new AmeliaBooking\Application\Services\Reservation\EventReservationService($c); |
| 192 | }; |
| 193 | |
| 194 | /** |
| 195 | * Booking service |
| 196 | * |
| 197 | * @param Container $c |
| 198 | * |
| 199 | * @return BookingApplicationService |
| 200 | */ |
| 201 | $entries['application.booking.booking.service'] = function ($c) { |
| 202 | return new AmeliaBooking\Application\Services\Booking\BookingApplicationService($c); |
| 203 | }; |
| 204 | |
| 205 | /** |
| 206 | * Bookable service |
| 207 | * |
| 208 | * @param Container $c |
| 209 | * |
| 210 | * @return BookableApplicationService |
| 211 | */ |
| 212 | $entries['application.bookable.service'] = function ($c) { |
| 213 | return new AmeliaBooking\Application\Services\Bookable\BookableApplicationService($c); |
| 214 | }; |
| 215 | |
| 216 | /** |
| 217 | * Bookable package |
| 218 | * |
| 219 | * @param Container $c |
| 220 | * |
| 221 | * @return AbstractPackageApplicationService |
| 222 | */ |
| 223 | $entries['application.bookable.package'] = function ($c) { |
| 224 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getPackageService($c); |
| 225 | }; |
| 226 | |
| 227 | /** |
| 228 | * Resource service |
| 229 | * |
| 230 | * @param Container $c |
| 231 | * |
| 232 | * @return AmeliaBooking\Application\Services\Resource\AbstractResourceApplicationService |
| 233 | */ |
| 234 | $entries['application.resource.service'] = function ($c) { |
| 235 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getResourceService($c); |
| 236 | }; |
| 237 | |
| 238 | /** |
| 239 | * Gallery service |
| 240 | * |
| 241 | * @param Container $c |
| 242 | * |
| 243 | * @return GalleryApplicationService |
| 244 | */ |
| 245 | $entries['application.gallery.service'] = function ($c) { |
| 246 | return new AmeliaBooking\Application\Services\Gallery\GalleryApplicationService($c); |
| 247 | }; |
| 248 | |
| 249 | /** |
| 250 | * Calendar service |
| 251 | * |
| 252 | * @param Container $c |
| 253 | * |
| 254 | * @return TimeSlotService |
| 255 | */ |
| 256 | $entries['application.timeSlot.service'] = function ($c) { |
| 257 | return new AmeliaBooking\Application\Services\TimeSlot\TimeSlotService($c); |
| 258 | }; |
| 259 | |
| 260 | /** |
| 261 | * Calendar provider service |
| 262 | * |
| 263 | * @param Container $c |
| 264 | * |
| 265 | * @return CalendarProviderService |
| 266 | */ |
| 267 | $entries['application.calendar.provider.service'] = function ($c) { |
| 268 | return new AmeliaBooking\Application\Services\Calendar\CalendarProviderService($c); |
| 269 | }; |
| 270 | |
| 271 | /** |
| 272 | * Calendar service |
| 273 | * |
| 274 | * @param Container $c |
| 275 | * |
| 276 | * @return WaitingListService |
| 277 | */ |
| 278 | $entries['application.waitingList.service'] = function ($c) { |
| 279 | return new AmeliaBooking\Application\Services\WaitingList\WaitingListService($c); |
| 280 | }; |
| 281 | |
| 282 | /** |
| 283 | * Cache service |
| 284 | * |
| 285 | * @param Container $c |
| 286 | * |
| 287 | * @return CacheApplicationService |
| 288 | */ |
| 289 | $entries['application.cache.service'] = function ($c) { |
| 290 | return new AmeliaBooking\Application\Services\Cache\CacheApplicationService($c); |
| 291 | }; |
| 292 | |
| 293 | /** |
| 294 | * Tax service |
| 295 | * |
| 296 | * @param Container $c |
| 297 | * |
| 298 | * @return AmeliaBooking\Application\Services\Tax\AbstractTaxApplicationService |
| 299 | */ |
| 300 | $entries['application.tax.service'] = function ($c) { |
| 301 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getTaxService($c); |
| 302 | }; |
| 303 | |
| 304 | /** |
| 305 | * Coupon service |
| 306 | * |
| 307 | * @param Container $c |
| 308 | * |
| 309 | * @return AmeliaBooking\Application\Services\Coupon\AbstractCouponApplicationService |
| 310 | */ |
| 311 | $entries['application.coupon.service'] = function ($c) { |
| 312 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getCouponService($c); |
| 313 | }; |
| 314 | |
| 315 | /** |
| 316 | * Location Service |
| 317 | * |
| 318 | * @param Container $c |
| 319 | * |
| 320 | * @return AmeliaBooking\Application\Services\Location\AbstractLocationApplicationService |
| 321 | */ |
| 322 | $entries['application.location.service'] = function ($c) { |
| 323 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getLocationService($c); |
| 324 | }; |
| 325 | |
| 326 | /** |
| 327 | * Notification Service |
| 328 | * |
| 329 | * @param Container $c |
| 330 | * |
| 331 | * @return AmeliaBooking\Application\Services\Notification\ApplicationNotificationService |
| 332 | */ |
| 333 | $entries['application.notification.service'] = function ($c) { |
| 334 | return new AmeliaBooking\Application\Services\Notification\ApplicationNotificationService($c); |
| 335 | }; |
| 336 | |
| 337 | /** |
| 338 | * Appointment Notification Service |
| 339 | * |
| 340 | * @param Container $c |
| 341 | * |
| 342 | * @return AmeliaBooking\Application\Services\Notification\AppointmentNotificationService |
| 343 | */ |
| 344 | $entries['application.notification.appointment.service'] = function ($c) { |
| 345 | return new AmeliaBooking\Application\Services\Notification\AppointmentNotificationService($c); |
| 346 | }; |
| 347 | |
| 348 | /** |
| 349 | * Email Notification Service |
| 350 | * |
| 351 | * @param Container $c |
| 352 | * |
| 353 | * @return \AmeliaBooking\Application\Services\Notification\EmailNotificationService |
| 354 | */ |
| 355 | $entries['application.emailNotification.service'] = function ($c) { |
| 356 | return new AmeliaBooking\Application\Services\Notification\EmailNotificationService($c, 'email'); |
| 357 | }; |
| 358 | |
| 359 | /** |
| 360 | * Notification Helper Service |
| 361 | * |
| 362 | * @param Container $c |
| 363 | * |
| 364 | * @return \AmeliaBooking\Application\Services\Notification\NotificationHelperService |
| 365 | */ |
| 366 | $entries['application.notificationHelper.service'] = function ($c) { |
| 367 | return new AmeliaBooking\Application\Services\Notification\NotificationHelperService($c); |
| 368 | }; |
| 369 | |
| 370 | /** |
| 371 | * SMS Notification Service |
| 372 | * |
| 373 | * @param Container $c |
| 374 | * |
| 375 | * @return \AmeliaBooking\Application\Services\Notification\SMSNotificationService |
| 376 | */ |
| 377 | $entries['application.smsNotification.service'] = function ($c) { |
| 378 | return new AmeliaBooking\Application\Services\Notification\SMSNotificationService($c, 'sms'); |
| 379 | }; |
| 380 | |
| 381 | |
| 382 | /** |
| 383 | * WhatsApp Notification Service |
| 384 | * |
| 385 | * @param Container $c |
| 386 | * |
| 387 | * @return AmeliaBooking\Application\Services\Notification\AbstractWhatsAppNotificationService |
| 388 | */ |
| 389 | $entries['application.whatsAppNotification.service'] = function ($c) { |
| 390 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getWhatsAppNotificationService($c); |
| 391 | }; |
| 392 | |
| 393 | /** |
| 394 | * Appointment Notification Service |
| 395 | * |
| 396 | * @param Container $c |
| 397 | * |
| 398 | * @return \AmeliaBooking\Application\Services\Placeholder\AppointmentPlaceholderService |
| 399 | */ |
| 400 | $entries['application.placeholder.appointment.service'] = function ($c) { |
| 401 | return new AmeliaBooking\Application\Services\Placeholder\AppointmentPlaceholderService($c); |
| 402 | }; |
| 403 | |
| 404 | /** |
| 405 | * Appointments Notification Service |
| 406 | * |
| 407 | * @param Container $c |
| 408 | * |
| 409 | * @return \AmeliaBooking\Application\Services\Placeholder\AppointmentsPlaceholderService |
| 410 | */ |
| 411 | $entries['application.placeholder.appointments.service'] = function ($c) { |
| 412 | return new AmeliaBooking\Application\Services\Placeholder\AppointmentsPlaceholderService($c); |
| 413 | }; |
| 414 | |
| 415 | /** |
| 416 | * Package Notification Service |
| 417 | * |
| 418 | * @param Container $c |
| 419 | * |
| 420 | * @return \AmeliaBooking\Application\Services\Placeholder\PackagePlaceholderService |
| 421 | */ |
| 422 | $entries['application.placeholder.package.service'] = function ($c) { |
| 423 | return new AmeliaBooking\Application\Services\Placeholder\PackagePlaceholderService($c); |
| 424 | }; |
| 425 | |
| 426 | /** |
| 427 | * Event Notification Service |
| 428 | * |
| 429 | * @param Container $c |
| 430 | * |
| 431 | * @return \AmeliaBooking\Application\Services\Placeholder\EventPlaceholderService |
| 432 | */ |
| 433 | $entries['application.placeholder.event.service'] = function ($c) { |
| 434 | return new AmeliaBooking\Application\Services\Placeholder\EventPlaceholderService($c); |
| 435 | }; |
| 436 | |
| 437 | /** |
| 438 | * Stats Service |
| 439 | * |
| 440 | * @param Container $c |
| 441 | * |
| 442 | * @return \AmeliaBooking\Application\Services\Stats\StatsService |
| 443 | */ |
| 444 | $entries['application.stats.service'] = function ($c) { |
| 445 | return new AmeliaBooking\Application\Services\Stats\StatsService($c); |
| 446 | }; |
| 447 | |
| 448 | /** |
| 449 | * Helper Service |
| 450 | * |
| 451 | * @param Container $c |
| 452 | * |
| 453 | * @return \AmeliaBooking\Application\Services\Helper\HelperService |
| 454 | */ |
| 455 | $entries['application.helper.service'] = function ($c) { |
| 456 | return new AmeliaBooking\Application\Services\Helper\HelperService($c); |
| 457 | }; |
| 458 | |
| 459 | /** |
| 460 | * Settings Service |
| 461 | * |
| 462 | * @param Container $c |
| 463 | * |
| 464 | * @return \AmeliaBooking\Application\Services\Settings\SettingsService |
| 465 | */ |
| 466 | $entries['application.settings.service'] = function ($c) { |
| 467 | return new AmeliaBooking\Application\Services\Settings\SettingsService($c); |
| 468 | }; |
| 469 | |
| 470 | /** |
| 471 | * SMS API Service |
| 472 | * |
| 473 | * @param Container $c |
| 474 | * |
| 475 | * @return \AmeliaBooking\Application\Services\Notification\SMSAPIService |
| 476 | */ |
| 477 | $entries['application.smsApi.service'] = function ($c) { |
| 478 | return new AmeliaBooking\Application\Services\Notification\SMSAPIService($c); |
| 479 | }; |
| 480 | |
| 481 | /** |
| 482 | * WhatsApp Service |
| 483 | * |
| 484 | * @param Container $c |
| 485 | * |
| 486 | * @return \AmeliaBooking\Application\Services\Notification\WhatsAppService |
| 487 | */ |
| 488 | $entries['application.whatsApp.service'] = function ($c) { |
| 489 | return new AmeliaBooking\Application\Services\Notification\WhatsAppService($c); |
| 490 | }; |
| 491 | |
| 492 | /** |
| 493 | * Payment service |
| 494 | * |
| 495 | * @param Container $c |
| 496 | * |
| 497 | * @return PaymentApplicationService |
| 498 | */ |
| 499 | $entries['application.payment.service'] = function ($c) { |
| 500 | return new AmeliaBooking\Application\Services\Payment\PaymentApplicationService($c); |
| 501 | }; |
| 502 | |
| 503 | /** |
| 504 | * Invoice service |
| 505 | * |
| 506 | * @param Container $c |
| 507 | * |
| 508 | * @return AmeliaBooking\Application\Services\Invoice\AbstractInvoiceApplicationService |
| 509 | */ |
| 510 | $entries['application.invoice.service'] = function ($c) { |
| 511 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getInvoiceService($c); |
| 512 | }; |
| 513 | |
| 514 | /** |
| 515 | * Custom Field Service |
| 516 | * |
| 517 | * @param Container $c |
| 518 | * |
| 519 | * @return AmeliaBooking\Application\Services\CustomField\AbstractCustomFieldApplicationService |
| 520 | */ |
| 521 | $entries['application.customField.service'] = function ($c) { |
| 522 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getCustomFieldService($c); |
| 523 | }; |
| 524 | |
| 525 | /** |
| 526 | * Web Hook Service |
| 527 | * |
| 528 | * @param Container $c |
| 529 | * |
| 530 | * @return AmeliaBooking\Application\Services\WebHook\AbstractWebHookApplicationService |
| 531 | */ |
| 532 | $entries['application.webHook.service'] = function ($c) { |
| 533 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getWebHookService($c); |
| 534 | }; |
| 535 | |
| 536 | /** |
| 537 | * Integration Service |
| 538 | * |
| 539 | * @param Container $c |
| 540 | * |
| 541 | * @return AmeliaBooking\Application\Services\Integration\ApplicationIntegrationService |
| 542 | */ |
| 543 | $entries['application.integration.service'] = function ($c) { |
| 544 | return new AmeliaBooking\Application\Services\Integration\ApplicationIntegrationService($c); |
| 545 | }; |
| 546 | |
| 547 | /** |
| 548 | * Zoom Service |
| 549 | * |
| 550 | * @param Container $c |
| 551 | * |
| 552 | * @return AmeliaBooking\Application\Services\Zoom\AbstractZoomApplicationService |
| 553 | */ |
| 554 | $entries['application.zoom.service'] = function ($c) { |
| 555 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getZoomService($c); |
| 556 | }; |
| 557 | |
| 558 | /** |
| 559 | * ICS File Service |
| 560 | * |
| 561 | * @param Container $c |
| 562 | * |
| 563 | * @return \AmeliaBooking\Application\Services\Booking\IcsApplicationService |
| 564 | */ |
| 565 | $entries['application.ics.service'] = function ($c) { |
| 566 | return new AmeliaBooking\Application\Services\Booking\IcsApplicationService($c); |
| 567 | }; |
| 568 | |
| 569 | /** |
| 570 | * Stash Service |
| 571 | * |
| 572 | * @param Container $c |
| 573 | * |
| 574 | * @return AmeliaBooking\Application\Services\Stash\StashApplicationService |
| 575 | */ |
| 576 | $entries['application.stash.service'] = function ($c) { |
| 577 | return new AmeliaBooking\Application\Services\Stash\StashApplicationService($c); |
| 578 | }; |
| 579 | |
| 580 | /** |
| 581 | * QR Code service |
| 582 | * |
| 583 | * @param Container $c |
| 584 | * |
| 585 | * @return AmeliaBooking\Application\Services\QrCode\AbstractQrCodeApplicationService |
| 586 | */ |
| 587 | $entries['application.qrcode.service'] = function ($c) { |
| 588 | return AmeliaBooking\Infrastructure\Licence\ApplicationService::getQrCodeService($c); |
| 589 | }; |
| 590 |