ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DelegatingFilesystemFactory.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 
5 
12 
24 {
25  private $implementation;
29  private $sanitizer;
30 
31 
38  {
39 
40  /*
41  * ---------- ABSTRACTION SWITCH -------------
42  * Change the factory to switch to another filesystem abstraction!
43  * current: FlySystem from the php league
44  * -------------------------------------------
45  */
46  $this->implementation = new FlySystemFilesystemFactory();
47 
48  $this->sanitizer = $sanitizer;
49  }
50 
51 
55  public function getLocal(LocalConfig $config, bool $read_only = false) : Filesystem
56  {
57  if ($read_only) {
58  return new ReadOnlyDecorator(new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer));
59  } else {
60  return new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer);
61  }
62  }
63 }
$config
Definition: bootstrap.php:15
__construct(FilenameSanitizer $sanitizer)
DelegatingFilesystemFactory constructor.
getLocal(LocalConfig $config, bool $read_only=false)
Class FlySystemFileAccessTest.