forked from php-standard-library/php-standard-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWriteMode.php
More file actions
38 lines (32 loc) · 1.08 KB
/
WriteMode.php
File metadata and controls
38 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Psl\File;
enum WriteMode: string
{
/**
* Open the file for writing only; place the file pointer at the beginning of
* the file.
*
* If the file exits, it is not truncated (as with `TRUNCATE`), and the call
* succeeds (unlike `MUST_CREATE`).
*/
case OPEN_OR_CREATE = 'cb';
/**
* Open for writing only; place the file pointer at the beginning of the
* file and truncate the file to zero length. If the file does not exist,
* attempt to create it.
*/
case TRUNCATE = 'wb';
/**
* Open for writing only; place the file pointer at the end of the file. If
* the file does not exist, attempt to create it. In this mode, seeking has
* no effect, writes are always appended.
*/
case APPEND = 'ab';
/**
* Create and open for writing only; place the file pointer at the beginning
* of the file. If the file already exists, the filesystem call will throw an
* exception. If the file does not exist, attempt to create it.
*/
case MUST_CREATE = 'xb';
}