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