Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Codes.php
Go to the documentation of this file.
1 <?php
7 
13 
18 {
24  private $fileSystem;
25 
31  private $flyweightFactory;
32 
38  public function __construct(
39  FlyweightFactory $flyweightFactory,
40  Filesystem $fileSystem
41  ) {
42  $this->fileSystem = $fileSystem;
43  $this->flyweightFactory = $flyweightFactory;
44  }
45 
51  public function getList($code, $area = DesignInterface::DEFAULT_AREA)
52  {
53  try {
54  $theme = $this->flyweightFactory->create($code, $area);
55  $reader = $this->fileSystem->getDirectoryRead(DirectoryList::STATIC_VIEW);
56  $dirs = $reader->read($theme->getFullPath());
57  } catch (\Exception $e) {
58  return [];
59  }
60 
61  return array_map('basename', $dirs);
62  }
63 }
getList($code, $area=DesignInterface::DEFAULT_AREA)
Definition: Codes.php:51
$theme
__construct(FlyweightFactory $flyweightFactory, Filesystem $fileSystem)
Definition: Codes.php:38
$code
Definition: info.phtml:12