Generator::createDirectory()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
ccs 0
cts 9
cp 0
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
crap 12
1
<?php
2
3
/*
4
 * This file is part of the "RocketORM" package.
5
 *
6
 * https://github.com/RocketORM/ORM
7
 *
8
 * For the full license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Rocket\ORM\Generator;
13
14
/**
15
 * @author Sylvain Lorinet <[email protected]>
16
 */
17
abstract class Generator implements GeneratorInterface
18
{
19
    /**
20
     * @param string $directory
21
     */
22
    protected function createDirectory($directory)
23
    {
24
        if (!is_dir($directory)) {
25
            if (!@mkdir($directory, 755, true)) {
26
                throw new \RuntimeException(
27
                    'The generator "' . end(explode('\\', get_called_class())) . '" cannot create directory "'
0 ignored issues
show
Bug introduced by
explode('\\', get_called_class()) cannot be passed to end() as the parameter $array expects a reference.
Loading history...
28
                    . $directory . '", error message : ' . error_get_last()['message']
29
                );
30
            }
31
        }
32
    }
33
}
34