vendor/coreshop/core-shop/src/CoreShop/Component/Tracking/Extractor/CompositeExtractor.php line 42

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * CoreShop
  5.  *
  6.  * This source file is available under two different licenses:
  7.  *  - GNU General Public License version 3 (GPLv3)
  8.  *  - CoreShop Commercial License (CCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  * @copyright  Copyright (c) CoreShop GmbH (https://www.coreshop.org)
  13.  * @license    https://www.coreshop.org/license     GPLv3 and CCL
  14.  *
  15.  */
  16. namespace CoreShop\Component\Tracking\Extractor;
  17. use CoreShop\Component\Registry\ServiceRegistryInterface;
  18. class CompositeExtractor implements TrackingExtractorInterface
  19. {
  20.     public function __construct(
  21.         private ServiceRegistryInterface $extractorRegistry,
  22.     ) {
  23.     }
  24.     public function supports($object): bool
  25.     {
  26.         return true;
  27.     }
  28.     public function updateMetadata($object$data = []): array
  29.     {
  30.         /**
  31.          * @var TrackingExtractorInterface $extractor
  32.          */
  33.         foreach ($this->extractorRegistry->all() as $extractor) {
  34.             if ($extractor->supports($object)) {
  35.                 $data $extractor->updateMetadata($object$data);
  36.             }
  37.         }
  38.         return $data;
  39.     }
  40. }