![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-url-rewrite/Model/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\UrlRewrite\Model; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite as UrlRewriteService; /** * This class is to be used as a container for new generated url rewrites by adding new ones using merge method * Removes duplicates for a set/array of Url Rewrites based on the unique key of the url_rewrites table * * @api * @since 100.1.3 */ class MergeDataProvider { const SEPARATOR = '_'; /** * @var $rewritesArray[] */ private $data = []; /** * Adds url rewrites to class data container by removing duplicates by a unique key * * @param UrlRewriteService[] $urlRewritesArray * @return void * @since 100.1.3 */ public function merge(array $urlRewritesArray) { foreach ($urlRewritesArray as $urlRewrite) { $key = $urlRewrite->getRequestPath() . self::SEPARATOR . $urlRewrite->getStoreId(); if ($key !== self::SEPARATOR) { $this->data[$key] = $urlRewrite; } else { $this->data[] = $urlRewrite; } } } /** * Returns the data added to container * * @return UrlRewriteService[] * @since 100.1.3 */ public function getData() { return $this->data; } }