EmptyGenerator::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 4
nop 1
1
<?php
2
3
namespace Admingenerator\GeneratorBundle\Builder;
4
5
/**
6
 * @author Cedric LOMBARDOT
7
 */
8
9
class EmptyGenerator extends Generator
10
{
11
12
    /**
13
     * Init a new generator and automatically define the base of temp directory.
14
     *
15
     * @param string $baseTempDir Optional base for temporary template files
16
     */
17
    public function __construct($baseTempDir = null)
18
    {
19
        if (null === $baseTempDir) {
20
            $baseTempDir = realpath(sys_get_temp_dir());
21
        }
22
23
        $this->tempDir = $baseTempDir.DIRECTORY_SEPARATOR.self::TEMP_DIR_PREFIX;
24
25
        if (!is_dir($this->tempDir)) {
26
            mkdir($this->tempDir, 0777, true);
27
        }
28
    }
29
}
30