![]() 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/old/vendor/magento/module-rss/Model/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Rss\Model; use Magento\Framework\App\Rss\DataProviderInterface; use Magento\Framework\App\Rss\RssManagerInterface; /** * Rss Manager * * @api * @since 100.0.2 */ class RssManager implements RssManagerInterface { /** * @var \Magento\Framework\App\Rss\DataProviderInterface[] */ protected $providers; /** * @var \Magento\Framework\ObjectManagerInterface */ private $objectManager; /** * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param array $dataProviders */ public function __construct( \Magento\Framework\ObjectManagerInterface $objectManager, array $dataProviders = [] ) { $this->objectManager = $objectManager; $this->providers = $dataProviders; } /** * Return Rss Data Provider by Rss Feed Id. * * @param string $type * @return DataProviderInterface * @throws \InvalidArgumentException */ public function getProvider($type) { if (!isset($this->providers[$type])) { throw new \InvalidArgumentException('Unknown provider with type: ' . $type); } $provider = $this->providers[$type]; if (is_string($provider)) { $provider = $this->objectManager->get($provider); } if (!$provider instanceof DataProviderInterface) { throw new \InvalidArgumentException('Provider should implement DataProviderInterface'); } $this->providers[$type] = $provider; return $this->providers[$type]; } /** * {@inheritdoc} */ public function getProviders() { $result = []; foreach (array_keys($this->providers) as $type) { $result[] = $this->getProvider($type); } return $result; } }