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 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\System\File
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\System\File;
16
17/**
18 * Filesystem class.
19 *
20 * Performing operations on the file system
21 *
22 * @package phpOMS\System\File
23 * @license OMS License 2.0
24 * @link    https://jingga.app
25 * @since   1.0.0
26 */
27interface FileInterface extends ContainerInterface
28{
29    /**
30     * Save content to file.
31     *
32     * @param string $content Content to save in file
33     * @param int    $mode    Mode (overwrite, append)
34     *
35     * @return bool
36     *
37     * @since 1.0.0
38     */
39    public function putContent(string $content, int $mode = ContentPutMode::APPEND | ContentPutMode::CREATE) : bool;
40
41    /**
42     * Save content to file.
43     *
44     * Creates new file if it doesn't exist or overwrites existing file.
45     *
46     * @param string $content Content to save in file
47     *
48     * @return bool
49     *
50     * @since 1.0.0
51     */
52    public function setContent(string $content) : bool;
53
54    /**
55     * Save content to file.
56     *
57     * Creates new file if it doesn't exist or overwrites existing file.
58     *
59     * @param string $content Content to save in file
60     *
61     * @return bool
62     *
63     * @since 1.0.0
64     */
65    public function appendContent(string $content) : bool;
66
67    /**
68     * Save content to file.
69     *
70     * Creates new file if it doesn't exist or overwrites existing file.
71     *
72     * @param string $content Content to save in file
73     *
74     * @return bool
75     *
76     * @since 1.0.0
77     */
78    public function prependContent(string $content) : bool;
79
80    /**
81     * Get content from file.
82     *
83     * @return string Content of file
84     *
85     * @since 1.0.0
86     */
87    public function getContent() : string;
88
89    /**
90     * Get file extension.
91     *
92     * @return string
93     *
94     * @since 1.0.0
95     */
96    public function getExtension() : string;
97}