Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Lib.php
Go to the documentation of this file.
1 <?php
7 
12 use Magento\Deploy\Package\PackageFileFactory;
13 
19 class Lib implements SourceInterface
20 {
21  const TYPE = 'lib';
22 
26  private $filesUtil;
27 
31  private $libDir;
32 
36  private $packageFileFactory;
37 
45  public function __construct(
46  Files $filesUtil,
48  PackageFileFactory $packageFileFactory
49  ) {
50  $this->filesUtil = $filesUtil;
51  $this->libDir = $filesystem->getDirectoryWrite(DirectoryList::LIB_WEB);
52  $this->packageFileFactory = $packageFileFactory;
53  }
54 
58  public function get()
59  {
60  $files = [];
61  foreach ($this->filesUtil->getStaticLibraryFiles() as $fileName) {
62  if (strpos($fileName, 'css/docs') === 0) {
63  continue;
64  }
65  $fullPath = $this->libDir->getAbsolutePath($fileName);
66  $params = [
67  'area' => Package::BASE_AREA,
68  'theme' => null,
69  'locale' => null,
70  'module' => null,
71  'fileName' => $fileName,
72  'sourcePath' => $fullPath
73  ];
74  $files[] = $this->packageFileFactory->create($params);
75  }
76  return $files;
77  }
78 }
$fileName
Definition: translate.phtml:15
__construct(Files $filesUtil, Filesystem $filesystem, PackageFileFactory $packageFileFactory)
Definition: Lib.php:45
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18
$filesystem
foreach($appDirs as $dir) $files