WriteMode
class WriteMode extends AbstractParameter
Selects what to do if the file already exists. The default for this union is add.
Your intent when writing a file to some path. This is used to determine what constitutes a conflict and what the
autorename strategy is.
In some situations, the conflict behavior is identical:
- If the target path doesn't contain anything, the file is always written; no conflict.
- If the target path contains a folder, it's always a conflict.
- If the target path contains a file with identical contents, nothing gets written; no conflict
The conflict checking differs in the case where there's a file at the target path with contents different from the contents you're trying to write
Constants
TAG_ADD |
Used by {@link WriteMode::add()} |
TAG_OVERWRITE |
Used by {@link WriteMode::overwrite()} |
TAG_UPDATE |
Used by {@link WriteMode::update()} |
Methods
Never overwrite the existing file. The autorename strategy is to append a number to the file name. For example, "document.txt" might become "document (2).txt".
Always overwrite the existing file. The autorename strategy is the same as it is for add.
Overwrite if the given "rev" matches the existing file's "rev". The autorename strategy is to append the string "conflicted copy" to the file name. For example, "document.txt" might become "document (conflicted copy).txt" or "document (Panda's conflicted copy).txt".
Details
in AbstractParameter at line line 64
array
jsonSerialize()
Specify data which should be serialized to JSON
in AbstractParameter at line line 75
string
__toString()
A shorthand for JSON-encoding parameters
at line line 74
static
WriteMode
add()
Never overwrite the existing file. The autorename strategy is to append a number to the file name. For example, "document.txt" might become "document (2).txt".
at line line 84
static
WriteMode
overwrite()
Always overwrite the existing file. The autorename strategy is the same as it is for add.
at line line 99
static
WriteMode
update(
string $rev)
Overwrite if the given "rev" matches the existing file's "rev". The autorename strategy is to append the string "conflicted copy" to the file name. For example, "document.txt" might become "document (conflicted copy).txt" or "document (Panda's conflicted copy).txt".