ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Handler.php
Go to the documentation of this file.
1<?php
2
3namespace League\Flysystem;
4
5use BadMethodCallException;
6
7abstract 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}
$metadata['__DYNAMIC:1__']
An exception for terminatinating execution or to throw for unit testing.
getType()
Retrieve the entree type (file|dir).
Definition: Handler.php:56
__call($method, array $arguments)
Plugins pass-through.
Definition: Handler.php:119
setFilesystem(FilesystemInterface $filesystem)
Set the Filesystem object.
Definition: Handler.php:70
getPath()
Retrieve the entree path.
Definition: Handler.php:106
__construct(FilesystemInterface $filesystem=null, $path=null)
Constructor.
Definition: Handler.php:25
getFilesystem()
Retrieve the Filesystem object.
Definition: Handler.php:82
isDir()
Check whether the entree is a directory.
Definition: Handler.php:36
isFile()
Check whether the entree is a file.
Definition: Handler.php:46
setPath($path)
Set the entree path.
Definition: Handler.php:94