Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
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) 2015-2020 (original work) Open Assessment Technologies SA;
19 *
20 */
21
22namespace oat\tao\model\media;
23
24use oat\tao\model\media\mediaSource\DirectorySearchQuery;
25
26/**
27 * Read interface to the media source
28 */
29interface MediaBrowser
30{
31    public function getDirectories(DirectorySearchQuery $params): array;
32
33    /**
34     * @deprecated MediaBrowser::getDirectories should be used instead
35     *
36     * @return array ['label' => $label,
37     *                'path' => $implIdentifier.'/'.$path,
38     *                'children' => [['label' => $label, 'path', $implIdentifier.'/'.$path, 'parent' => $parentPath]]
39     *                'total' => $total
40     *               ]
41     */
42    public function getDirectory($parentLink = '/', $acceptableMime = [], $depth = 1);
43
44    /**
45     * @param string $link
46     * @return array  ['name' => $filename,
47     *                'mime' => $mimeType,
48     *                'uri' => $uri,
49     *                'filePath' => $filePath,
50     *                'size' => $fileSize,
51     *               ]
52     * filePath : relative path to the file (to get a tree)
53     * @throws \tao_models_classes_FileNotFoundException
54     */
55    public function getFileInfo($link);
56
57    /**
58     * @param string $link
59     * @return string path of the file to download
60     * @throws \tao_models_classes_FileNotFoundException
61     */
62    public function download($link);
63
64    /**
65     * Get the stream linked to the media
66     * @param string $link
67     * @throws \tao_models_classes_FileNotFoundException
68     * @return \Psr\Http\Message\StreamInterface
69     */
70    public function getFileStream($link);
71
72    /**
73     * @param string $link
74     * @return string baseName of the file
75     * @throws \tao_models_classes_FileNotFoundException
76     */
77    public function getBaseName($link);
78}