ClassFileWriter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 35
rs 10
c 0
b 0
f 0
ccs 0
cts 7
cp 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B write() 0 32 1
1
<?php
2
3
namespace Brazanation\States\Console\Commands\Generate;
4
5
class ClassFileWriter
6
{
7
    public function write($path, GenericState $state)
8
    {
9
        $fileContent = <<<FILE
10
<?php
11
12
namespace Brazanation\States;
13
14
class {$state->getClassName()} extends State
15
{
16
    const CODE = {$state->getCode()};
17
18
    const FULL_NAME = '{$state->getFullName()}';
19
20
    const SHORT_NAME = '{$state->getShortName()}';
21
22
    const TIMEZONE = '{$state->getTimeZone()}';
23
24
    public function __construct()
25
    {
26
        parent::__construct(
27
            self::FULL_NAME,
28
            self::SHORT_NAME,
29
            self::CODE,
30
            self::TIMEZONE
31
        );
32
    }
33
}
34
35
FILE;
36
37
        return file_put_contents("{$path}/{$state->getClassName()}.php", $fileContent);
38
    }
39
}
40