| Total Complexity | 111 |
| Total Lines | 1050 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like GlueApplicationFactory often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use GlueApplicationFactory, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 152 | class GlueApplicationFactory extends AbstractFactory |
||
| 153 | { |
||
| 154 | /** |
||
| 155 | * @return \Spryker\Glue\GlueApplication\Rest\ControllerFilterInterface |
||
| 156 | */ |
||
| 157 | public function createRestControllerFilter(): ControllerFilterInterface |
||
| 158 | { |
||
| 159 | return new ControllerFilter( |
||
| 160 | $this->createRestRequestFormatter(), |
||
| 161 | $this->createRestResponseFormatter(), |
||
| 162 | $this->createRestResponseHeaders(), |
||
| 163 | $this->createRestHttpRequestValidator(), |
||
| 164 | $this->createRestRequestValidator(), |
||
| 165 | $this->createRestUserValidator(), |
||
| 166 | $this->createRestResourceBuilder(), |
||
| 167 | $this->createRestControllerCallbacks(), |
||
| 168 | $this->getConfig(), |
||
| 169 | $this->createUserProvider(), |
||
| 170 | $this->createFormattedControllerBeforeAction(), |
||
| 171 | ); |
||
| 172 | } |
||
| 173 | |||
| 174 | /** |
||
| 175 | * @return \Spryker\Glue\GlueApplication\Rest\Request\RequestFormatterInterface |
||
| 176 | */ |
||
| 177 | public function createRestRequestFormatter(): RequestFormatterInterface |
||
| 178 | { |
||
| 179 | return new RequestFormatter( |
||
| 180 | $this->createRestRequestMetaDataExtractor(), |
||
| 181 | $this->createRestRequestResourceExtractor(), |
||
| 182 | $this->getConfig(), |
||
| 183 | $this->getFormatRequestPlugins(), |
||
| 184 | ); |
||
| 185 | } |
||
| 186 | |||
| 187 | /** |
||
| 188 | * @return \Spryker\Glue\GlueApplication\Rest\Response\ResponseFormatterInterface |
||
| 189 | */ |
||
| 190 | public function createRestResponseFormatter(): RestResponseFormatterInterface |
||
| 191 | { |
||
| 192 | return new RestResponseFormatter( |
||
| 193 | $this->createRestEncoderMatcher(), |
||
| 194 | $this->createRestResponseBuilder(), |
||
| 195 | $this->getFormatResponseDataPlugins(), |
||
| 196 | ); |
||
| 197 | } |
||
| 198 | |||
| 199 | /** |
||
| 200 | * @return \Spryker\Glue\GlueApplication\Rest\ResourceRelationshipLoaderInterface |
||
| 201 | */ |
||
| 202 | public function createRestResourceRelationshipLoader(): ResourceRelationshipLoaderInterface |
||
| 203 | { |
||
| 204 | return new ResourceRelationshipLoader($this->getResourceProviderPlugins()); |
||
| 205 | } |
||
| 206 | |||
| 207 | /** |
||
| 208 | * @return \Spryker\Glue\GlueApplication\Rest\ResourceRouterInterface |
||
| 209 | */ |
||
| 210 | public function createRestResourceRouter(): RestResourceRouterInterface |
||
| 211 | { |
||
| 212 | return new RestResourceRouter( |
||
| 213 | $this->createRestHttpRequestValidator(), |
||
| 214 | $this->getGlueApplication(), |
||
| 215 | $this->createRestUriParser(), |
||
| 216 | $this->createRestResourceRouteLoader(), |
||
| 217 | $this->getRouterParameterExpanderPlugins(), |
||
| 218 | ); |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @return \Spryker\Glue\GlueApplication\Rest\Response\ResponseBuilderInterface |
||
| 223 | */ |
||
| 224 | public function createRestResponseBuilder(): ResponseBuilderInterface |
||
| 225 | { |
||
| 226 | return new ResponseBuilder( |
||
| 227 | $this->getConfig()->getGlueDomainName(), |
||
| 228 | $this->createRestResponsePagination(), |
||
| 229 | $this->createRestResponseRelationship(), |
||
| 230 | ); |
||
| 231 | } |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @return \Spryker\Glue\GlueApplication\Rest\Response\ResponseHeadersInterface |
||
| 235 | */ |
||
| 236 | public function createRestResponseHeaders(): ResponseHeadersInterface |
||
| 237 | { |
||
| 238 | return new ResponseHeaders( |
||
| 239 | $this->getFormatResponseHeadersPlugins(), |
||
| 240 | $this->createRestContentTypeResolver(), |
||
| 241 | $this->getConfig(), |
||
| 242 | ); |
||
| 243 | } |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @return \Spryker\Glue\GlueApplication\Rest\Request\RequestMetaDataExtractorInterface |
||
| 247 | */ |
||
| 248 | public function createRestRequestMetaDataExtractor(): RequestMetaDataExtractorInterface |
||
| 254 | ); |
||
| 255 | } |
||
| 256 | |||
| 257 | /** |
||
| 258 | * @return \Spryker\Glue\GlueApplication\Rest\Serialize\DecoderMatcherInterface |
||
| 259 | */ |
||
| 260 | public function createRestDecoderMatcher(): DecoderMatcherInterface |
||
| 261 | { |
||
| 262 | return new DecoderMatcher([ |
||
| 263 | DecoderMatcher::DEFAULT_FORMAT => $this->createJsonDecoder(), |
||
| 264 | ]); |
||
| 265 | } |
||
| 266 | |||
| 267 | /** |
||
| 268 | * @return \Spryker\Glue\GlueApplication\Rest\Serialize\EncoderMatcherInterface |
||
| 269 | */ |
||
| 270 | public function createRestEncoderMatcher(): EncoderMatcherInterface |
||
| 271 | { |
||
| 272 | return new EncoderMatcher([ |
||
| 273 | EncoderMatcher::DEFAULT_FORMAT => $this->createJsonEncoder(), |
||
| 274 | ]); |
||
| 275 | } |
||
| 276 | |||
| 277 | /** |
||
| 278 | * @return \Spryker\Glue\GlueApplication\Serialize\Encoder\EncoderInterface |
||
| 279 | */ |
||
| 280 | public function createJsonEncoder(): EncoderInterface |
||
| 281 | { |
||
| 282 | return new JsonEncoder($this->getUtilEncodingService()); |
||
| 283 | } |
||
| 284 | |||
| 285 | /** |
||
| 286 | * @return \Spryker\Glue\GlueApplication\Serialize\Decoder\DecoderInterface |
||
| 287 | */ |
||
| 288 | public function createJsonDecoder(): DecoderInterface |
||
| 289 | { |
||
| 290 | return new JsonDecoder($this->getUtilEncodingService()); |
||
| 291 | } |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @return \Spryker\Glue\GlueApplication\Rest\Uri\UriParserInterface |
||
| 295 | */ |
||
| 296 | public function createRestUriParser(): RestUriParserInterface |
||
| 297 | { |
||
| 298 | return new RestUriParser($this->createRestVersionResolver()); |
||
| 299 | } |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @return \Spryker\Glue\GlueApplication\Rest\ResourceRouteLoaderInterface |
||
| 303 | */ |
||
| 304 | public function createRestResourceRouteLoader(): ResourceRouteLoaderInterface |
||
| 305 | { |
||
| 306 | return new ResourceRouteLoader( |
||
| 307 | $this->getResourceRoutePlugins(), |
||
| 308 | $this->createRestVersionResolver(), |
||
| 309 | $this->getRouterParameterExpanderPlugins(), |
||
| 310 | ); |
||
| 311 | } |
||
| 312 | |||
| 313 | /** |
||
| 314 | * @return \Spryker\Glue\GlueApplication\Rest\Request\HttpRequestValidatorInterface |
||
| 315 | */ |
||
| 316 | public function createRestHttpRequestValidator(): HttpRequestValidatorInterface |
||
| 317 | { |
||
| 318 | return new HttpRequestValidator( |
||
| 319 | $this->getValidateRequestPlugins(), |
||
| 320 | $this->createRestResourceRouteLoader(), |
||
| 321 | $this->getConfig(), |
||
| 322 | $this->createHeadersHttpRequestValidator(), |
||
| 323 | ); |
||
| 324 | } |
||
| 325 | |||
| 326 | /** |
||
| 327 | * @return \Spryker\Glue\GlueApplication\Rest\Request\FormattedControllerBeforeActionInterface |
||
| 328 | */ |
||
| 329 | public function createFormattedControllerBeforeAction(): FormattedControllerBeforeActionInterface |
||
| 330 | { |
||
| 331 | return new FormattedControllerBeforeAction($this->getFormattedControllerBeforeActionPlugins()); |
||
| 332 | } |
||
| 333 | |||
| 334 | /** |
||
| 335 | * @deprecated Use {@link \Spryker\Glue\GlueApplication\Plugin\EventDispatcher\GlueRestControllerListenerEventDispatcherPlugin} instead. |
||
| 336 | * |
||
| 337 | * @return \Spryker\Glue\GlueApplication\Plugin\Rest\GlueControllerListenerPlugin |
||
| 338 | */ |
||
| 339 | public function createRestControllerListener(): GlueControllerListenerPlugin |
||
| 340 | { |
||
| 341 | return new GlueControllerListenerPlugin(); |
||
|
|
|||
| 342 | } |
||
| 343 | |||
| 344 | /** |
||
| 345 | * @return \Spryker\Glue\GlueApplication\Rest\JsonApi\RestResourceBuilderInterface |
||
| 346 | */ |
||
| 347 | public function createRestResourceBuilder(): RestResourceBuilderInterface |
||
| 348 | { |
||
| 349 | return new RestResourceBuilder(); |
||
| 350 | } |
||
| 351 | |||
| 352 | /** |
||
| 353 | * @return \Spryker\Glue\GlueApplication\Rest\Request\RestRequestValidatorInterface |
||
| 354 | */ |
||
| 355 | public function createRestRequestValidator(): RestRequestValidatorInterface |
||
| 356 | { |
||
| 357 | return new RestRequestValidator($this->getValidateRestRequestPlugins(), $this->getRestRequestValidatorPlugins()); |
||
| 358 | } |
||
| 359 | |||
| 360 | /** |
||
| 361 | * @return \Spryker\Glue\GlueApplication\Rest\ControllerCallbacksInterface |
||
| 362 | */ |
||
| 363 | public function createRestControllerCallbacks(): ControllerCallbacksInterface |
||
| 364 | { |
||
| 365 | return new ControllerCallbacks($this->getControllerBeforeActionPlugins(), $this->getControllerAfterActionPlugins()); |
||
| 366 | } |
||
| 367 | |||
| 368 | /** |
||
| 369 | * @return \Spryker\Glue\GlueApplication\Rest\Version\VersionResolverInterface |
||
| 370 | */ |
||
| 371 | public function createRestVersionResolver(): VersionResolverInterface |
||
| 372 | { |
||
| 373 | return new VersionResolver($this->createRestContentTypeResolver(), $this->getConfig()); |
||
| 374 | } |
||
| 375 | |||
| 376 | /** |
||
| 377 | * @return \Spryker\Glue\GlueApplication\Rest\ContentType\ContentTypeResolverInterface |
||
| 378 | */ |
||
| 379 | public function createRestContentTypeResolver(): ContentTypeResolverInterface |
||
| 380 | { |
||
| 381 | return new ContentTypeResolver(); |
||
| 382 | } |
||
| 383 | |||
| 384 | /** |
||
| 385 | * @return \Spryker\Glue\GlueApplication\Rest\Cors\CorsResponseInterface |
||
| 386 | */ |
||
| 387 | public function createRestCorsResponse(): CorsResponseInterface |
||
| 388 | { |
||
| 389 | return new CorsResponse($this->createRestResourceRouteLoader(), $this->getConfig(), $this->createRestUriParser()); |
||
| 390 | } |
||
| 391 | |||
| 392 | /** |
||
| 393 | * @return \Spryker\Glue\GlueApplication\Rest\Language\LanguageNegotiationInterface |
||
| 394 | */ |
||
| 395 | public function createLanguageNegotiation(): LanguageNegotiationInterface |
||
| 396 | { |
||
| 397 | return new LanguageNegotiation($this->getStoreClient(), $this->getLocaleService()); |
||
| 398 | } |
||
| 399 | |||
| 400 | /** |
||
| 401 | * @return \Spryker\Glue\GlueApplication\Rest\Response\ResponsePaginationInterface |
||
| 402 | */ |
||
| 403 | public function createRestResponsePagination(): ResponsePaginationInterface |
||
| 404 | { |
||
| 405 | return new ResponsePagination($this->getConfig()); |
||
| 406 | } |
||
| 407 | |||
| 408 | /** |
||
| 409 | * @return \Spryker\Glue\GlueApplication\Rest\Response\ResponseRelationshipInterface |
||
| 410 | */ |
||
| 411 | public function createRestResponseRelationship(): ResponseRelationshipInterface |
||
| 412 | { |
||
| 413 | return new ResponseRelationship($this->createRestResourceRelationshipLoader()); |
||
| 414 | } |
||
| 415 | |||
| 416 | /** |
||
| 417 | * @return \Spryker\Glue\GlueApplication\Rest\Request\RequestResourceExtractorInterface |
||
| 418 | */ |
||
| 419 | public function createRestRequestResourceExtractor(): RequestResourceExtractorInterface |
||
| 420 | { |
||
| 421 | return new RequestResourceExtractor( |
||
| 422 | $this->createRestResourceBuilder(), |
||
| 423 | $this->createRestDecoderMatcher(), |
||
| 424 | ); |
||
| 425 | } |
||
| 426 | |||
| 427 | /** |
||
| 428 | * @return \Spryker\Glue\GlueApplication\Rest\User\UserProviderInterface |
||
| 429 | */ |
||
| 430 | public function createUserProvider(): UserProviderInterface |
||
| 431 | { |
||
| 432 | return new UserProvider( |
||
| 433 | $this->getRestUserFinderPlugins(), |
||
| 434 | ); |
||
| 435 | } |
||
| 436 | |||
| 437 | /** |
||
| 438 | * @return \Spryker\Glue\GlueApplication\Rest\User\RestUserValidatorInterface |
||
| 439 | */ |
||
| 440 | public function createRestUserValidator(): RestUserValidatorInterface |
||
| 441 | { |
||
| 442 | return new RestUserValidator( |
||
| 443 | $this->getRestUserValidatorPlugins(), |
||
| 444 | ); |
||
| 445 | } |
||
| 446 | |||
| 447 | /** |
||
| 448 | * @return \Spryker\Glue\GlueApplication\Rest\Request\PaginationParametersHttpRequestValidatorInterface |
||
| 449 | */ |
||
| 450 | public function createPaginationParametersRequestValidator(): PaginationParametersHttpRequestValidatorInterface |
||
| 451 | { |
||
| 452 | return new PaginationParametersHttpRequestValidator(); |
||
| 453 | } |
||
| 454 | |||
| 455 | /** |
||
| 456 | * @return \Spryker\Glue\GlueApplication\Rest\Request\HeadersHttpRequestValidatorInterface |
||
| 457 | */ |
||
| 458 | public function createHeadersHttpRequestValidator(): HeadersHttpRequestValidatorInterface |
||
| 459 | { |
||
| 460 | return new HeadersHttpRequestValidator( |
||
| 461 | $this->getConfig(), |
||
| 462 | $this->createRestResourceRouteLoader(), |
||
| 463 | ); |
||
| 464 | } |
||
| 465 | |||
| 466 | /** |
||
| 467 | * @return \Spryker\Glue\GlueApplication\Rest\Request\CorsHttpRequestValidatorInterface |
||
| 468 | */ |
||
| 469 | public function createCorsHttpRequestValidator(): CorsHttpRequestValidatorInterface |
||
| 470 | { |
||
| 471 | return new CorsHttpRequestValidator(); |
||
| 472 | } |
||
| 473 | |||
| 474 | /** |
||
| 475 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ValidateRestRequestPluginInterface> |
||
| 476 | */ |
||
| 477 | public function getValidateRestRequestPlugins(): array |
||
| 478 | { |
||
| 479 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_VALIDATE_REST_REQUEST); |
||
| 480 | } |
||
| 481 | |||
| 482 | /** |
||
| 483 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RestUserValidatorPluginInterface> |
||
| 484 | */ |
||
| 485 | public function getRestUserValidatorPlugins(): array |
||
| 486 | { |
||
| 487 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_VALIDATE_REST_USER); |
||
| 488 | } |
||
| 489 | |||
| 490 | /** |
||
| 491 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RestRequestValidatorPluginInterface> |
||
| 492 | */ |
||
| 493 | public function getRestRequestValidatorPlugins(): array |
||
| 494 | { |
||
| 495 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_REST_REQUEST_VALIDATOR); |
||
| 496 | } |
||
| 497 | |||
| 498 | /** |
||
| 499 | * @return \Spryker\Service\Container\ContainerInterface |
||
| 500 | */ |
||
| 501 | public function getGlueApplication(): ContainerInterface |
||
| 502 | { |
||
| 503 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::APPLICATION_GLUE); |
||
| 504 | } |
||
| 505 | |||
| 506 | /** |
||
| 507 | * @return \Spryker\Glue\GlueApplication\Dependency\Service\GlueApplicationToUtilEncodingServiceInterface |
||
| 508 | */ |
||
| 509 | public function getUtilEncodingService(): GlueApplicationToUtilEncodingServiceInterface |
||
| 510 | { |
||
| 511 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::SERVICE_UTIL_ENCODING); |
||
| 512 | } |
||
| 513 | |||
| 514 | /** |
||
| 515 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRoutePluginInterface> |
||
| 516 | */ |
||
| 517 | public function getResourceRoutePlugins(): array |
||
| 518 | { |
||
| 519 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_RESOURCE_ROUTES); |
||
| 520 | } |
||
| 521 | |||
| 522 | /** |
||
| 523 | * @return \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface |
||
| 524 | */ |
||
| 525 | public function getResourceProviderPlugins(): ResourceRelationshipCollectionInterface |
||
| 526 | { |
||
| 527 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_RESOURCE_RELATIONSHIP); |
||
| 528 | } |
||
| 529 | |||
| 530 | /** |
||
| 531 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ValidateHttpRequestPluginInterface> |
||
| 532 | */ |
||
| 533 | public function getValidateRequestPlugins(): array |
||
| 534 | { |
||
| 535 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_VALIDATE_HTTP_REQUEST); |
||
| 536 | } |
||
| 537 | |||
| 538 | /** |
||
| 539 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\FormattedControllerBeforeActionPluginInterface> |
||
| 540 | */ |
||
| 541 | public function getFormattedControllerBeforeActionPlugins(): array |
||
| 542 | { |
||
| 543 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_FORMATTED_CONTROLLER_BEFORE_ACTION); |
||
| 544 | } |
||
| 545 | |||
| 546 | /** |
||
| 547 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\FormatRequestPluginInterface> |
||
| 548 | */ |
||
| 549 | public function getFormatRequestPlugins(): array |
||
| 550 | { |
||
| 551 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_FORMAT_REQUEST); |
||
| 552 | } |
||
| 553 | |||
| 554 | /** |
||
| 555 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\FormatResponseDataPluginInterface> |
||
| 556 | */ |
||
| 557 | public function getFormatResponseDataPlugins(): array |
||
| 558 | { |
||
| 559 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_FORMAT_RESPONSE_DATA); |
||
| 560 | } |
||
| 561 | |||
| 562 | /** |
||
| 563 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\FormatResponseHeadersPluginInterface> |
||
| 564 | */ |
||
| 565 | public function getFormatResponseHeadersPlugins(): array |
||
| 566 | { |
||
| 567 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_FORMAT_RESPONSE_HEADERS); |
||
| 568 | } |
||
| 569 | |||
| 570 | /** |
||
| 571 | * @return \Spryker\Glue\GlueApplication\Dependency\Client\GlueApplicationToStoreClientInterface |
||
| 572 | */ |
||
| 573 | public function getStoreClient(): GlueApplicationToStoreClientInterface |
||
| 574 | { |
||
| 575 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::CLIENT_STORE); |
||
| 576 | } |
||
| 577 | |||
| 578 | /** |
||
| 579 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ControllerBeforeActionPluginInterface> |
||
| 580 | */ |
||
| 581 | public function getControllerBeforeActionPlugins(): array |
||
| 582 | { |
||
| 583 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_CONTROLLER_BEFORE_ACTION); |
||
| 584 | } |
||
| 585 | |||
| 586 | /** |
||
| 587 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ControllerAfterActionPluginInterface> |
||
| 588 | */ |
||
| 589 | public function getControllerAfterActionPlugins(): array |
||
| 590 | { |
||
| 591 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_CONTROLLER_AFTER_ACTION); |
||
| 592 | } |
||
| 593 | |||
| 594 | /** |
||
| 595 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RestUserFinderPluginInterface> |
||
| 596 | */ |
||
| 597 | public function getRestUserFinderPlugins(): array |
||
| 598 | { |
||
| 599 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_REST_USER_FINDER); |
||
| 600 | } |
||
| 601 | |||
| 602 | /** |
||
| 603 | * @return \Spryker\Service\Container\ContainerInterface |
||
| 604 | */ |
||
| 605 | public function createServiceContainer(): ContainerInterface |
||
| 606 | { |
||
| 607 | return new ContainerProxy(['logger' => null, 'debug' => $this->getConfig()->isDebugModeEnabled(), 'charset' => 'UTF-8']); |
||
| 608 | } |
||
| 609 | |||
| 610 | /** |
||
| 611 | * @return array<\Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface> |
||
| 612 | */ |
||
| 613 | public function getApplicationPlugins(): array |
||
| 614 | { |
||
| 615 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_APPLICATION); |
||
| 616 | } |
||
| 617 | |||
| 618 | /** |
||
| 619 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RouterParameterExpanderPluginInterface> |
||
| 620 | */ |
||
| 621 | public function getRouterParameterExpanderPlugins(): array |
||
| 622 | { |
||
| 623 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_ROUTER_PARAMETER_EXPANDER); |
||
| 624 | } |
||
| 625 | |||
| 626 | /** |
||
| 627 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\GlueContextExpanderPluginInterface> |
||
| 628 | */ |
||
| 629 | public function getGlueContextExpanderPlugins(): array |
||
| 630 | { |
||
| 631 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGIN_API_CONTEXT_EXPANDER); |
||
| 632 | } |
||
| 633 | |||
| 634 | /** |
||
| 635 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\GlueApplicationBootstrapPluginInterface> |
||
| 636 | */ |
||
| 637 | public function getBootstrapPlugins(): array |
||
| 638 | { |
||
| 639 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_GLUE_APPLICATION_BOOTSTRAP); |
||
| 640 | } |
||
| 641 | |||
| 642 | /** |
||
| 643 | * @param array<string> $glueApplicationBootstrapPluginClassNames |
||
| 644 | * |
||
| 645 | * @return \Spryker\Glue\GlueApplication\ApiApplication\ApiApplicationBootstrapResolverInterface |
||
| 646 | */ |
||
| 647 | public function createApiApplicationBootstrapResolver(array $glueApplicationBootstrapPluginClassNames = []): ApiApplicationBootstrapResolverInterface |
||
| 648 | { |
||
| 649 | return new ApiApplicationBootstrapResolver($glueApplicationBootstrapPluginClassNames, $this->getBootstrapPlugins()); |
||
| 650 | } |
||
| 651 | |||
| 652 | /** |
||
| 653 | * @param \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\GlueApplicationBootstrapPluginInterface $glueApplicationBootstrapPlugin |
||
| 654 | * |
||
| 655 | * @return \Spryker\Shared\Application\ApplicationInterface |
||
| 656 | */ |
||
| 657 | public function createApiApplicationProxy(GlueApplicationBootstrapPluginInterface $glueApplicationBootstrapPlugin): ApplicationInterface |
||
| 658 | { |
||
| 659 | return new ApiApplicationProxy( |
||
| 660 | $glueApplicationBootstrapPlugin, |
||
| 661 | $this->createRequestFlowExecutor(), |
||
| 662 | $this->getCommunicationProtocolPlugins(), |
||
| 663 | $this->getConventionPlugins(), |
||
| 664 | $this->createHttpRequestBuilder(), |
||
| 665 | $this->createHttpSender(), |
||
| 666 | $this->createContentNegotiator(), |
||
| 667 | $this->createRequest(), |
||
| 668 | $this->getConfig(), |
||
| 669 | ); |
||
| 670 | } |
||
| 671 | |||
| 672 | /** |
||
| 673 | * @return \Spryker\Shared\Application\ApplicationInterface |
||
| 674 | */ |
||
| 675 | public function createGlueStorefrontFallbackApiApplication(): ApplicationInterface |
||
| 676 | { |
||
| 677 | return new GlueStorefrontFallbackApiApplication($this->createServiceContainer(), $this->getApplicationPlugins()); |
||
| 678 | } |
||
| 679 | |||
| 680 | /** |
||
| 681 | * @return \Spryker\Glue\GlueApplication\ApiApplication\RequestFlowExecutorInterface |
||
| 682 | */ |
||
| 683 | public function createRequestFlowExecutor(): RequestFlowExecutorInterface |
||
| 684 | { |
||
| 685 | return new RequestFlowExecutor( |
||
| 686 | $this->createResourceExecutor(), |
||
| 687 | $this->createRouteMatcher(), |
||
| 688 | $this->createRequestBuilder(), |
||
| 689 | $this->createRequestValidator(), |
||
| 690 | $this->createResponseFormatter(), |
||
| 691 | ); |
||
| 692 | } |
||
| 693 | |||
| 694 | /** |
||
| 695 | * @return \Spryker\Glue\GlueApplication\Builder\RequestBuilderInterface |
||
| 696 | */ |
||
| 697 | public function createRequestBuilder(): RequestBuilderWrapperInterface |
||
| 698 | { |
||
| 699 | return new RequestBuilderWrapper( |
||
| 700 | $this->getRequestBuilderPlugins(), |
||
| 701 | $this->createRequestBuilders(), |
||
| 702 | ); |
||
| 703 | } |
||
| 704 | |||
| 705 | /** |
||
| 706 | * @return \Spryker\Glue\GlueApplication\Validator\RequestValidatorInterface |
||
| 707 | */ |
||
| 708 | public function createRequestValidator(): RequestValidatorInterface |
||
| 709 | { |
||
| 710 | return new RequestValidator( |
||
| 711 | $this->getRequestValidatorPlugins(), |
||
| 712 | $this->getRequestAfterRoutingValidatorPlugins(), |
||
| 713 | $this->createRequestValidators(), |
||
| 714 | ); |
||
| 715 | } |
||
| 716 | |||
| 717 | /** |
||
| 718 | * @return \Spryker\Glue\GlueApplication\Formatter\ResponseFormatterInterface |
||
| 719 | */ |
||
| 720 | public function createResponseFormatter(): ResponseFormatterInterface |
||
| 721 | { |
||
| 722 | return new ResponseFormatter( |
||
| 723 | $this->getResponseFormatterPlugins(), |
||
| 724 | $this->createResponseFormatters(), |
||
| 725 | ); |
||
| 726 | } |
||
| 727 | |||
| 728 | /** |
||
| 729 | * @deprecated Will be removed without replacement. |
||
| 730 | * |
||
| 731 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\CommunicationProtocolPluginInterface> |
||
| 732 | */ |
||
| 733 | public function getCommunicationProtocolPlugins(): array |
||
| 734 | { |
||
| 735 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_COMMUNICATION_PROTOCOL); |
||
| 736 | } |
||
| 737 | |||
| 738 | /** |
||
| 739 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ConventionPluginInterface> |
||
| 740 | */ |
||
| 741 | public function getConventionPlugins(): array |
||
| 742 | { |
||
| 743 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_CONVENTION); |
||
| 744 | } |
||
| 745 | |||
| 746 | /** |
||
| 747 | * @return \Spryker\Glue\GlueApplication\Executor\ResourceExecutorInterface |
||
| 748 | */ |
||
| 749 | public function createResourceExecutor(): ResourceExecutorInterface |
||
| 750 | { |
||
| 751 | return new ResourceExecutor( |
||
| 752 | $this->createControllerCacheReader(), |
||
| 753 | $this->createControllerCacheWriter(), |
||
| 754 | $this->getConfig(), |
||
| 755 | ); |
||
| 756 | } |
||
| 757 | |||
| 758 | /** |
||
| 759 | * @return \Spryker\Glue\GlueApplication\Router\ResourceRouter\RequestResourcePluginFilterInterface |
||
| 760 | */ |
||
| 761 | public function createRequestResourcePluginFilter(): RequestResourcePluginFilterInterface |
||
| 762 | { |
||
| 763 | return new RequestResourcePluginFilter($this->createConventionResourceFilter()); |
||
| 764 | } |
||
| 765 | |||
| 766 | /** |
||
| 767 | * @return \Spryker\Glue\GlueApplication\Router\ResourceRouter\ConventionResourceFilterInterface |
||
| 768 | */ |
||
| 769 | public function createConventionResourceFilter(): ConventionResourceFilterInterface |
||
| 770 | { |
||
| 771 | return new ConventionResourceFilter($this->getConventionPlugins()); |
||
| 772 | } |
||
| 773 | |||
| 774 | /** |
||
| 775 | * @return \Spryker\Glue\GlueApplication\Plugin\Console\Helper\DescriptorHelper |
||
| 776 | */ |
||
| 777 | public function createDescriptorHelper(): DescriptorHelper |
||
| 778 | { |
||
| 779 | return new DescriptorHelper( |
||
| 780 | $this->createTextDescriptor(), |
||
| 781 | ); |
||
| 782 | } |
||
| 783 | |||
| 784 | /** |
||
| 785 | * @return \Spryker\Glue\GlueApplication\Descriptor\TextDescriptor |
||
| 786 | */ |
||
| 787 | public function createTextDescriptor(): TextDescriptor |
||
| 788 | { |
||
| 789 | return new TextDescriptor( |
||
| 790 | $this->getTableColumnExpanderPlugins(), |
||
| 791 | ); |
||
| 792 | } |
||
| 793 | |||
| 794 | /** |
||
| 795 | * @param \Symfony\Component\Console\Input\InputInterface $input |
||
| 796 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
| 797 | * |
||
| 798 | * @return \Symfony\Component\Console\Style\SymfonyStyle |
||
| 799 | */ |
||
| 800 | public function createConsoleOutputStyle(InputInterface $input, OutputInterface $output): SymfonyStyle |
||
| 801 | { |
||
| 802 | return new SymfonyStyle($input, $output); |
||
| 803 | } |
||
| 804 | |||
| 805 | /** |
||
| 806 | * @return \Spryker\Glue\GlueApplication\Router\ResourceRouter\Uri\UriParserInterface |
||
| 807 | */ |
||
| 808 | public function createUriParser(): UriParserInterface |
||
| 809 | { |
||
| 810 | return new UriParser(); |
||
| 811 | } |
||
| 812 | |||
| 813 | /** |
||
| 814 | * @return \Spryker\Glue\GlueApplication\Cache\Writer\ControllerCacheWriterInterface |
||
| 815 | */ |
||
| 816 | public function createControllerCacheWriter(): ControllerCacheWriterInterface |
||
| 817 | { |
||
| 818 | return new ControllerCacheWriter( |
||
| 819 | $this->getControllerCacheCollectorPlugins(), |
||
| 820 | $this->getConfig(), |
||
| 821 | $this->getFilesystem(), |
||
| 822 | $this->getControllerConfigurationCacheCollectorPlugins(), |
||
| 823 | ); |
||
| 824 | } |
||
| 825 | |||
| 826 | /** |
||
| 827 | * @return \Spryker\Glue\GlueApplication\Cache\Reader\ControllerCacheReaderInterface |
||
| 828 | */ |
||
| 829 | public function createControllerCacheReader(): ControllerCacheReaderInterface |
||
| 830 | { |
||
| 831 | return new ControllerCacheReader( |
||
| 832 | $this->createControllerCacheWriter(), |
||
| 833 | $this->getConfig(), |
||
| 834 | ); |
||
| 835 | } |
||
| 836 | |||
| 837 | /** |
||
| 838 | * @return \Spryker\Glue\GlueApplication\Dependency\External\GlueApplicationToSymfonyFilesystemInterface |
||
| 839 | */ |
||
| 840 | public function getFilesystem(): GlueApplicationToSymfonyFilesystemInterface |
||
| 841 | { |
||
| 842 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::FILESYSTEM); |
||
| 843 | } |
||
| 844 | |||
| 845 | /** |
||
| 846 | * @deprecated Use {@link \Spryker\Glue\GlueApplication\GlueApplicationFactory::getControllerConfigurationCacheCollectorPlugins()} instead. |
||
| 847 | * |
||
| 848 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ControllerCacheCollectorPluginInterface> |
||
| 849 | */ |
||
| 850 | public function getControllerCacheCollectorPlugins(): array |
||
| 851 | { |
||
| 852 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_CONTROLLER_CACHE_COLLECTOR); |
||
| 853 | } |
||
| 854 | |||
| 855 | /** |
||
| 856 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ControllerConfigurationCacheCollectorPluginInterface> |
||
| 857 | */ |
||
| 858 | public function getControllerConfigurationCacheCollectorPlugins(): array |
||
| 859 | { |
||
| 860 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_CONTROLLER_CONFIGURATION_CACHE_COLLECTOR); |
||
| 861 | } |
||
| 862 | |||
| 863 | /** |
||
| 864 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ApiApplicationEndpointProviderPluginInterface> |
||
| 865 | */ |
||
| 866 | public function getGlueApplicationRouterProviderPlugins(): array |
||
| 867 | { |
||
| 868 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_GLUE_APPLICATION_ROUTER_PROVIDER); |
||
| 869 | } |
||
| 870 | |||
| 871 | /** |
||
| 872 | * @return \Spryker\Glue\GlueApplication\Router\RouteMatcherInterface |
||
| 873 | */ |
||
| 874 | public function createCustomRouteMatcher(): RouteMatcherInterface |
||
| 875 | { |
||
| 876 | return new CustomRouteMatcher($this->createRouterBuilder()); |
||
| 877 | } |
||
| 878 | |||
| 879 | /** |
||
| 880 | * @return \Spryker\Glue\GlueApplication\Router\RouteMatcherInterface |
||
| 881 | */ |
||
| 882 | public function createResourceRouteMatcher(): RouteMatcherInterface |
||
| 883 | { |
||
| 884 | return new ResourceRouteMatcher( |
||
| 885 | $this->getResourcesProviderPlugins(), |
||
| 886 | $this->createUriParser(), |
||
| 887 | $this->createRequestResourcePluginFilter(), |
||
| 888 | ); |
||
| 889 | } |
||
| 890 | |||
| 891 | /** |
||
| 892 | * @return \Spryker\Glue\GlueApplication\Router\RouteMatcherInterface |
||
| 893 | */ |
||
| 894 | public function createRouteMatcher(): RouteMatcherInterface |
||
| 895 | { |
||
| 896 | return new RouteMatcherCollection( |
||
| 897 | $this->getRouteMatchers(), |
||
| 898 | $this->getConfig(), |
||
| 899 | $this->createRouterCacheCollector(), |
||
| 900 | ); |
||
| 901 | } |
||
| 902 | |||
| 903 | /** |
||
| 904 | * @return array<\Spryker\Glue\GlueApplication\Router\RouteMatcherInterface> |
||
| 905 | */ |
||
| 906 | public function getRouteMatchers(): array |
||
| 907 | { |
||
| 908 | return [ |
||
| 909 | 'routes' => $this->createCustomRouteMatcher(), |
||
| 910 | 'resources' => $this->createResourceRouteMatcher(), |
||
| 911 | ]; |
||
| 912 | } |
||
| 913 | |||
| 914 | /** |
||
| 915 | * @return \Spryker\Glue\GlueApplication\Router\CustomRouteRouter\Builder\RouterBuilderInterface |
||
| 916 | */ |
||
| 917 | public function createRouterBuilder(): RouterBuilderInterface |
||
| 918 | { |
||
| 919 | return new RouterBuilder($this->getRoutesProviderPlugins()); |
||
| 920 | } |
||
| 921 | |||
| 922 | /** |
||
| 923 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RoutesProviderPluginInterface> |
||
| 924 | */ |
||
| 925 | public function getRoutesProviderPlugins(): array |
||
| 926 | { |
||
| 927 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_ROUTES_PROVIDER); |
||
| 928 | } |
||
| 929 | |||
| 930 | /** |
||
| 931 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourcesProviderPluginInterface> |
||
| 932 | */ |
||
| 933 | public function getResourcesProviderPlugins(): array |
||
| 934 | { |
||
| 935 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_RESOURCES_PROVIDER); |
||
| 936 | } |
||
| 937 | |||
| 938 | /** |
||
| 939 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\TableColumnExpanderPluginInterface> |
||
| 940 | */ |
||
| 941 | public function getTableColumnExpanderPlugins(): array |
||
| 942 | { |
||
| 943 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_TABLE_COLUMN_EXPANDER); |
||
| 944 | } |
||
| 945 | |||
| 946 | /** |
||
| 947 | * @return \Spryker\Glue\GlueApplication\Router\CustomRouteRouter\Cache\RouterCacheCollectorInterface |
||
| 948 | */ |
||
| 949 | public function createRouterCacheCollector(): RouterCacheCollectorInterface |
||
| 950 | { |
||
| 951 | return new RouterCacheCollector( |
||
| 952 | $this->createRouterBuilder(), |
||
| 953 | $this->getRoutesProviderPlugins(), |
||
| 954 | ); |
||
| 955 | } |
||
| 956 | |||
| 957 | /** |
||
| 958 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RequestBuilderPluginInterface> |
||
| 959 | */ |
||
| 960 | public function getRequestBuilderPlugins(): array |
||
| 961 | { |
||
| 962 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_REQUEST_BUILDER); |
||
| 963 | } |
||
| 964 | |||
| 965 | /** |
||
| 966 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RequestValidatorPluginInterface> |
||
| 967 | */ |
||
| 968 | public function getRequestValidatorPlugins(): array |
||
| 969 | { |
||
| 970 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_REQUEST_VALIDATOR); |
||
| 971 | } |
||
| 972 | |||
| 973 | /** |
||
| 974 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\RequestAfterRoutingValidatorPluginInterface> |
||
| 975 | */ |
||
| 976 | public function getRequestAfterRoutingValidatorPlugins(): array |
||
| 977 | { |
||
| 978 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_REQUEST_AFTER_ROUTING_VALIDATOR); |
||
| 979 | } |
||
| 980 | |||
| 981 | /** |
||
| 982 | * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResponseFormatterPluginInterface> |
||
| 983 | */ |
||
| 984 | public function getResponseFormatterPlugins(): array |
||
| 985 | { |
||
| 986 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::PLUGINS_RESPONSE_FORMATTER); |
||
| 987 | } |
||
| 988 | |||
| 989 | /** |
||
| 990 | * @return \Spryker\Glue\GlueApplication\Dependency\External\GlueApplicationToInflectorInterface |
||
| 991 | */ |
||
| 992 | public function getInflector(): GlueApplicationToInflectorInterface |
||
| 993 | { |
||
| 994 | return $this->getProvidedDependency(GlueApplicationDependencyProvider::INFLECTOR); |
||
| 995 | } |
||
| 996 | |||
| 997 | /** |
||
| 998 | * @return \Spryker\Glue\GlueApplication\Formatter\Schema\RestApiSchemaParametersFormatterInterface |
||
| 999 | */ |
||
| 1000 | public function createRestApiSchemaParametersFormatter(): RestApiSchemaParametersFormatterInterface |
||
| 1001 | { |
||
| 1002 | return new RestApiSchemaParametersFormatter(); |
||
| 1003 | } |
||
| 1004 | |||
| 1005 | /** |
||
| 1006 | * @return \Spryker\Glue\GlueApplication\Validator\Request\RequestValidatorInterface |
||
| 1007 | */ |
||
| 1008 | public function createAcceptedFormatValidator(): RequestRequestValidatorInterface |
||
| 1009 | { |
||
| 1010 | return new AcceptedFormatValidator($this->getResponseEncoderStrategies()); |
||
| 1011 | } |
||
| 1012 | |||
| 1013 | /** |
||
| 1014 | * @return \Spryker\Glue\GlueApplication\Builder\Request\RequestBuilderInterface |
||
| 1015 | */ |
||
| 1016 | public function createFilterFieldRequestBuilder(): RequestBuilderInterface |
||
| 1017 | { |
||
| 1018 | return new FilterFieldRequestBuilder(); |
||
| 1019 | } |
||
| 1020 | |||
| 1021 | /** |
||
| 1022 | * @return \Spryker\Glue\GlueApplication\Builder\Request\RequestBuilderInterface |
||
| 1023 | */ |
||
| 1024 | public function createSparseFieldRequestBuilder(): RequestBuilderInterface |
||
| 1025 | { |
||
| 1026 | return new SparseFieldRequestBuilder(); |
||
| 1027 | } |
||
| 1028 | |||
| 1029 | /** |
||
| 1030 | * @return \Spryker\Glue\GlueApplication\Builder\Request\RequestBuilderInterface |
||
| 1031 | */ |
||
| 1032 | public function createAttributesRequestBuilder(): RequestBuilderInterface |
||
| 1033 | { |
||
| 1034 | return new AttributesRequestBuilder( |
||
| 1035 | $this->getUtilEncodingService(), |
||
| 1036 | ); |
||
| 1037 | } |
||
| 1038 | |||
| 1039 | /** |
||
| 1040 | * @return \Spryker\Glue\GlueApplication\Formatter\Response\ResponseFormatterInterface |
||
| 1041 | */ |
||
| 1042 | public function createDefaultResponseFormatter(): DefaultConventionResponseFormatterInterface |
||
| 1043 | { |
||
| 1044 | return new DefaultConventionResponseFormatter( |
||
| 1045 | $this->getResponseEncoderStrategies(), |
||
| 1046 | $this->getConfig(), |
||
| 1047 | ); |
||
| 1048 | } |
||
| 1049 | |||
| 1050 | /** |
||
| 1051 | * @return \Spryker\Glue\GlueApplication\Http\Request\RequestBuilderInterface |
||
| 1052 | */ |
||
| 1053 | public function createHttpRequestBuilder(): HttpRequestBuilderInterface |
||
| 1054 | { |
||
| 1055 | return new HttpRequestBuilder( |
||
| 1056 | $this->createRequest(), |
||
| 1057 | ); |
||
| 1058 | } |
||
| 1059 | |||
| 1060 | /** |
||
| 1061 | * @return \Spryker\Glue\GlueApplication\Http\Response\HttpSenderInterface; |
||
| 1062 | */ |
||
| 1063 | public function createHttpSender(): HttpSenderInterface |
||
| 1064 | { |
||
| 1065 | return new HttpSender( |
||
| 1066 | $this->createResponse(), |
||
| 1067 | ); |
||
| 1068 | } |
||
| 1069 | |||
| 1070 | /** |
||
| 1071 | * @return \Symfony\Component\HttpFoundation\Response |
||
| 1072 | */ |
||
| 1073 | public function createResponse(): Response |
||
| 1074 | { |
||
| 1075 | return new Response(); |
||
| 1076 | } |
||
| 1077 | |||
| 1078 | /** |
||
| 1079 | * @return \Symfony\Component\HttpFoundation\Request |
||
| 1080 | */ |
||
| 1081 | public function createRequest(): Request |
||
| 1082 | { |
||
| 1083 | return Request::createFromGlobals(); |
||
| 1084 | } |
||
| 1085 | |||
| 1086 | /** |
||
| 1087 | * @return \Spryker\Glue\GlueApplication\Http\Context\ContextHttpExpanderInterface |
||
| 1088 | */ |
||
| 1089 | public function createContextHttpExpander(): ContextHttpExpanderInterface |
||
| 1090 | { |
||
| 1091 | return new ContextHttpExpander( |
||
| 1092 | $this->createRequest(), |
||
| 1093 | ); |
||
| 1094 | } |
||
| 1095 | |||
| 1096 | /** |
||
| 1097 | * @return \Spryker\Glue\GlueApplication\Formatter\Schema\SchemaFormatterInterface |
||
| 1098 | */ |
||
| 1099 | public function createRestApiSchemaFormatter(): SchemaFormatterInterface |
||
| 1100 | { |
||
| 1101 | return new RestApiSchemaFormatter( |
||
| 1102 | $this->getInflector(), |
||
| 1103 | $this->createRestApiSchemaParametersFormatter(), |
||
| 1104 | $this->getConfig(), |
||
| 1105 | ); |
||
| 1106 | } |
||
| 1107 | |||
| 1108 | /** |
||
| 1109 | * @return \Spryker\Glue\GlueApplication\Builder\Request\RequestBuilderInterface |
||
| 1110 | */ |
||
| 1111 | public function createPaginationParameterRequestBuilder(): RequestBuilderInterface |
||
| 1112 | { |
||
| 1113 | return new PaginationParameterRequestBuilder(); |
||
| 1114 | } |
||
| 1115 | |||
| 1116 | /** |
||
| 1117 | * @return \Spryker\Glue\GlueApplication\Builder\Request\RequestBuilderInterface |
||
| 1118 | */ |
||
| 1119 | public function createSortParameterRequestBuilder(): RequestBuilderInterface |
||
| 1120 | { |
||
| 1121 | return new SortParameterRequestBuilder(); |
||
| 1122 | } |
||
| 1123 | |||
| 1124 | /** |
||
| 1125 | * @return \Spryker\Glue\GlueApplication\Encoder\Response\ResponseEncoderStrategyInterface |
||
| 1126 | */ |
||
| 1127 | public function createJsonResponseEncoderStrategy(): ResponseEncoderStrategyInterface |
||
| 1128 | { |
||
| 1129 | return new JsonResponseEncoderStrategy($this->getUtilEncodingService()); |
||
| 1130 | } |
||
| 1131 | |||
| 1132 | /** |
||
| 1133 | * @return array<\Spryker\Glue\GlueApplication\Encoder\Response\ResponseEncoderStrategyInterface> |
||
| 1134 | */ |
||
| 1135 | public function getResponseEncoderStrategies(): array |
||
| 1136 | { |
||
| 1137 | return [ |
||
| 1138 | $this->createJsonResponseEncoderStrategy(), |
||
| 1139 | ]; |
||
| 1140 | } |
||
| 1141 | |||
| 1142 | /** |
||
| 1143 | * @return array<\Spryker\Glue\GlueApplication\Builder\Request\RequestBuilderInterface> |
||
| 1144 | */ |
||
| 1145 | public function createRequestBuilders(): array |
||
| 1153 | ]; |
||
| 1154 | } |
||
| 1155 | |||
| 1156 | /** |
||
| 1157 | * @return array<\Spryker\Glue\GlueApplication\Validator\Request\RequestValidatorInterface> |
||
| 1158 | */ |
||
| 1159 | public function createRequestValidators(): array |
||
| 1160 | { |
||
| 1161 | return [ |
||
| 1162 | $this->createAcceptedFormatValidator(), |
||
| 1163 | $this->createFilterRequestValidator(), |
||
| 1164 | ]; |
||
| 1165 | } |
||
| 1166 | |||
| 1167 | /** |
||
| 1168 | * @return array<\Spryker\Glue\GlueApplication\Formatter\Response\ResponseFormatterInterface> |
||
| 1169 | */ |
||
| 1170 | public function createResponseFormatters(): array |
||
| 1171 | { |
||
| 1172 | return [ |
||
| 1173 | $this->createDefaultResponseFormatter(), |
||
| 1174 | ]; |
||
| 1175 | } |
||
| 1176 | |||
| 1177 | /** |
||
| 1178 | * @return \Spryker\Glue\GlueApplication\ContentNegotiator\ContentNegotiatorInterface |
||
| 1179 | */ |
||
| 1180 | public function createContentNegotiator(): ContentNegotiatorInterface |
||
| 1181 | { |
||
| 1182 | return new ContentNegotiator( |
||
| 1183 | $this->getConventionPlugins(), |
||
| 1184 | $this->getResponseEncoderStrategies(), |
||
| 1185 | ); |
||
| 1186 | } |
||
| 1187 | |||
| 1188 | /** |
||
| 1189 | * @return \Spryker\Glue\GlueApplication\Validator\Request\RequestValidatorInterface |
||
| 1190 | */ |
||
| 1191 | public function createFilterRequestValidator(): RequestRequestValidatorInterface |
||
| 1192 | { |
||
| 1193 | return new FilterRequestValidator(); |
||
| 1194 | } |
||
| 1195 | |||
| 1196 | /** |
||
| 1197 | * @return \Spryker\Glue\GlueApplication\Dependency\Service\GlueApplicationToLocaleServiceInterface |
||
| 1198 | */ |
||
| 1199 | public function getLocaleService(): GlueApplicationToLocaleServiceInterface |
||
| 1202 | } |
||
| 1203 | } |
||
| 1204 |