Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FileList.php
Go to the documentation of this file.
1 <?php
8 
11 
15 class FileList
16 {
22  protected $files = [];
23 
29  protected $collator;
30 
37  {
38  $this->collator = $collator;
39  }
40 
46  public function getAll()
47  {
48  return array_values($this->files);
49  }
50 
58  public function add(array $files)
59  {
60  foreach ($files as $file) {
61  $identifier = $file->getFileIdentifier();
62  if (array_key_exists($identifier, $this->files)) {
63  $filename = $this->files[$identifier]->getFilename();
64  throw new \LogicException(
65  "View file '{$file->getFilename()}' is indistinguishable from the file '{$filename}'."
66  );
67  }
68  $this->files[$identifier] = $file;
69  }
70  }
71 
78  public function replace(array $files)
79  {
80  $this->files = $this->collator->collate($files, $this->files);
81  }
82 }
__construct(CollateInterface $collator)
Definition: FileList.php:36