Conditions | 9 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function __construct(string $name, string $context = 'app', string $appDir = '') |
||
22 | { |
||
23 | $this->name = $name; |
||
24 | try { |
||
25 | $this->appDir = $appDir ?: dirname((new \ReflectionClass($name . '\Module\AppModule'))->getFileName(), 3); |
||
26 | } catch (\ReflectionException $e) { |
||
27 | throw new AppNameException($name); |
||
28 | } |
||
29 | $this->tmpDir = $this->appDir . '/var/tmp/' . $context; |
||
30 | if (! file_exists($this->tmpDir) && ! @mkdir($this->tmpDir, 0777, true) && ! is_dir($this->tmpDir)) { |
||
31 | throw new NotWritableException($this->tmpDir); |
||
32 | } |
||
33 | $this->logDir = $this->appDir . '/var/log/' . $context; |
||
34 | if (! file_exists($this->logDir) && ! @mkdir($this->logDir, 0777, true) && ! is_dir($this->logDir)) { |
||
35 | throw new NotWritableException($this->logDir); |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 |