EmptyGenerator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
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