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 file is part of the phpBB Forum Software package.
5 *
6 * @copyright (c) phpBB Limited <https://www.phpbb.com>
7 * @license GNU General Public License, version 2 (GPL-2.0)
8 *
9 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14namespace phpbb\storage\adapter;
15
16use phpbb\storage\exception\storage_exception;
17
18interface adapter_interface
19{
20    /**
21     * Set adapter parameters
22     *
23     * @param array $options options    Storage-specific options.
24     */
25    public function configure(array $options): void;
26
27    /**
28     * Reads a file as a stream
29     *
30     * @param string $path File to read
31     *
32     * @return resource Returns a file pointer
33     * @throws storage_exception When unable to open file
34     */
35    public function read(string $path);
36
37    /**
38     * Writes a new file using a stream
39     *
40     * @param string $path The target file
41     * @param resource $resource The resource
42     *
43     * @return int Returns the number of bytes written
44     * @throws storage_exception When target file exists
45     * When target file cannot be created
46     */
47    public function write(string $path, $resource): int;
48
49    /**
50     * Removes files or directories
51     *
52     * @param string $path file/directory to remove
53     *
54     * @throws storage_exception When removal fails.
55     */
56    public function delete(string $path): void;
57
58    /**
59     * Get space available in bytes
60     *
61     * @return float Returns available space
62     * @throws storage_exception When unable to retrieve available storage space
63     */
64    public function free_space(): float;
65}