major refactoring under the hood
[pharext/pharext] / src / pharext / Tempname.php
1 <?php
2
3 namespace pharext;
4
5 /**
6 * A temporary file/directory name
7 */
8 class Tempname
9 {
10 /**
11 * @var string
12 */
13 private $name;
14
15 /**
16 * @param string $prefix uniqid() prefix
17 * @param string $suffix e.g. file extension
18 */
19 public function __construct($prefix, $suffix = null) {
20 $this->name = sys_get_temp_dir() . "/" . uniqid($prefix) . $suffix;
21 }
22
23 /**
24 * @return string
25 */
26 public function __toString() {
27 return (string) $this->name;
28 }
29 }