Changeset View
Changeset View
Standalone View
Standalone View
src/filesystem/TempFile.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Simple wrapper to create a temporary file and guarantee it will be deleted on | * Simple wrapper to create a temporary file and guarantee it will be deleted on | ||||
| * object destruction. Used like a string to path: | * object destruction. Used like a string to path: | ||||
| * | * | ||||
| * $temp = new TempFile(); | * $temp = new TempFile(); | ||||
| * Filesystem::writeFile($temp, 'Hello World'); | * Filesystem::writeFile($temp, 'Hello World'); | ||||
| * echo "Wrote data to path: ".$temp; | * echo "Wrote data to path: ".$temp; | ||||
| * | * | ||||
| * Throws Filesystem exceptions for errors. | * Throws Filesystem exceptions for errors. | ||||
| * | * | ||||
| * @task create Creating a Temporary File | * @task create Creating a Temporary File | ||||
| * @task config Configuration | * @task config Configuration | ||||
| * @task internal Internals | * @task internal Internals | ||||
| */ | */ | ||||
| final class TempFile { | final class TempFile extends Phobject { | ||||
| private $dir; | private $dir; | ||||
| private $file; | private $file; | ||||
| private $preserve; | private $preserve; | ||||
| private $destroyed = false; | private $destroyed = false; | ||||
| /* -( Creating a Temporary File )------------------------------------------ */ | /* -( Creating a Temporary File )------------------------------------------ */ | ||||
| ▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines | |||||