Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DefaultScope.php
Go to the documentation of this file.
1 <?php
7 
9 use Magento\Store\Model\ResourceModel\Config\Collection\ScopedFactory;
12 
16 class DefaultScope implements SourceInterface
17 {
21  private $collectionFactory;
22 
26  private $converter;
27 
32  public function __construct(
33  ScopedFactory $collectionFactory,
34  Converter $converter
35  ) {
36  $this->collectionFactory = $collectionFactory;
37  $this->converter = $converter;
38  }
39 
46  public function get($scopeCode = null)
47  {
48  try {
49  $collection = $this->collectionFactory->create(
51  );
52  } catch (\DomainException $e) {
53  $collection = [];
54  }
55  $config = [];
56  foreach ($collection as $item) {
57  $config[$item->getPath()] = $item->getValue();
58  }
59  return $this->converter->convert($config);
60  }
61 }
$config
Definition: fraud_order.php:17
__construct(ScopedFactory $collectionFactory, Converter $converter)