Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| FileSystem | |
0.00% |
0 / 7 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFileSystem | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAdapter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFullPath | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2016 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\oatbox\filesystem; |
| 23 | |
| 24 | use League\Flysystem\FilesystemOperator; |
| 25 | use oat\oatbox\filesystem\utils\FileSystemWrapperTrait; |
| 26 | use League\Flysystem\FilesystemAdapter; |
| 27 | |
| 28 | /** |
| 29 | * Class Filesystem |
| 30 | */ |
| 31 | class FileSystem implements FilesystemInterface |
| 32 | { |
| 33 | use FileSystemWrapperTrait; |
| 34 | |
| 35 | /** |
| 36 | * @var string |
| 37 | */ |
| 38 | protected $id; |
| 39 | |
| 40 | /** |
| 41 | * @var FilesystemOperator |
| 42 | */ |
| 43 | protected $filesystem; |
| 44 | |
| 45 | /** |
| 46 | * @var string |
| 47 | */ |
| 48 | protected $prefix; |
| 49 | |
| 50 | /** |
| 51 | * Filesystem constructor. |
| 52 | * |
| 53 | * @param $id |
| 54 | * @param $adapter |
| 55 | */ |
| 56 | public function __construct($id, FilesystemOperator $flySystem, $prefix) |
| 57 | { |
| 58 | $this->id = $id; |
| 59 | $this->filesystem = $flySystem; |
| 60 | $this->prefix = $prefix; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @return mixed |
| 65 | */ |
| 66 | public function getId() |
| 67 | { |
| 68 | return $this->id; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @return FilesystemOperator |
| 73 | */ |
| 74 | protected function getFileSystem(): FilesystemOperator |
| 75 | { |
| 76 | return $this->filesystem; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Get the Adapter. |
| 81 | * |
| 82 | * @return FilesystemAdapter adapter |
| 83 | */ |
| 84 | public function getAdapter() |
| 85 | { |
| 86 | return $this->getFileSystem()->getAdapter(); |
| 87 | } |
| 88 | |
| 89 | protected function getFullPath($path) |
| 90 | { |
| 91 | return $this->prefix . '/' . $path; |
| 92 | } |
| 93 | } |