ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
DelegatingFilesystemFactory.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 
5 
12 
22 {
23  private $implementation;
27  private $sanitizer;
28 
34  {
35 
36  /*
37  * ---------- ABSTRACTION SWITCH -------------
38  * Change the factory to switch to another filesystem abstraction!
39  * current: FlySystem from the php league
40  * -------------------------------------------
41  */
42  $this->implementation = new FlySystemFilesystemFactory();
43 
44  $this->sanitizer = $sanitizer;
45  }
46 
50  public function getLocal(LocalConfig $config, bool $read_only = false) : Filesystem
51  {
52  if ($read_only) {
53  return new ReadOnlyDecorator(new FilesystemWhitelistDecorator($this->implementation->getLocal($config),
55  } else {
56  return new FilesystemWhitelistDecorator($this->implementation->getLocal($config), $this->sanitizer);
57  }
58  }
59 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
__construct(FilenameSanitizer $sanitizer)
DelegatingFilesystemFactory constructor.
Class DelegatingFilesystemFactory The delegating filesystem factory delegates the instance creation t...
getLocal(LocalConfig $config, bool $read_only=false)
Interface FilesystemFactory The filesystem factory produces different filesystem types.
Class LocalConfig This class is used to configure the local filesystem adapter.
Definition: LocalConfig.php:13
Class FlySystemFileAccessTest disabled disabled disabled.