Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace OpenSpout\Common;
6
 
7
use OpenSpout\Common\Exception\InvalidArgumentException;
8
 
9
/**
10
 * @internal
11
 */
12
trait TempFolderOptionTrait
13
{
14
    private string $tempFolder;
15
 
16
    final public function setTempFolder(string $tempFolder): void
17
    {
18
        if (!is_dir($tempFolder) || !is_writable($tempFolder)) {
19
            throw new InvalidArgumentException("{$tempFolder} is not a writable folder");
20
        }
21
 
22
        $this->tempFolder = $tempFolder;
23
    }
24
 
25
    final public function getTempFolder(): string
26
    {
27
        if (!isset($this->tempFolder)) {
28
            $this->setTempFolder(sys_get_temp_dir());
29
        }
30
 
31
        return $this->tempFolder;
32
    }
33
}