ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Handler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace League\Flysystem;
4 
6 
7 abstract class Handler
8 {
12  protected $path;
13 
17  protected $filesystem;
18 
25  public function __construct(FilesystemInterface $filesystem = null, $path = null)
26  {
27  $this->path = $path;
28  $this->filesystem = $filesystem;
29  }
30 
36  public function isDir()
37  {
38  return $this->getType() === 'dir';
39  }
40 
46  public function isFile()
47  {
48  return $this->getType() === 'file';
49  }
50 
56  public function getType()
57  {
58  $metadata = $this->filesystem->getMetadata($this->path);
59 
60  return $metadata['type'];
61  }
62 
71  {
72  $this->filesystem = $filesystem;
73 
74  return $this;
75  }
76 
82  public function getFilesystem()
83  {
84  return $this->filesystem;
85  }
86 
94  public function setPath($path)
95  {
96  $this->path = $path;
97 
98  return $this;
99  }
100 
106  public function getPath()
107  {
108  return $this->path;
109  }
110 
119  public function __call($method, array $arguments)
120  {
121  array_unshift($arguments, $this->path);
122  $callback = [$this->filesystem, $method];
123 
124  try {
125  return call_user_func_array($callback, $arguments);
126  } catch (BadMethodCallException $e) {
127  throw new BadMethodCallException(
128  'Call to undefined method '
129  . get_called_class()
130  . '::' . $method
131  );
132  }
133  }
134 }
isDir()
Check whether the entree is a directory.
Definition: Handler.php:36
getFilesystem()
Retrieve the Filesystem object.
Definition: Handler.php:82
__construct(FilesystemInterface $filesystem=null, $path=null)
Constructor.
Definition: Handler.php:25
getType()
Retrieve the entree type (file|dir).
Definition: Handler.php:56
setFilesystem(FilesystemInterface $filesystem)
Set the Filesystem object.
Definition: Handler.php:70
$metadata['__DYNAMIC:1__']
getPath()
Retrieve the entree path.
Definition: Handler.php:106
Create styles array
The data for the language used.
isFile()
Check whether the entree is a file.
Definition: Handler.php:46
__call($method, array $arguments)
Plugins pass-through.
Definition: Handler.php:119
setPath($path)
Set the entree path.
Definition: Handler.php:94