Completed
Push — master ( 7c9e2e...904e9e )
by Dmitry
11:28 queued 05:32
created

Cache   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 54.55%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 0
cbo 3
dl 0
loc 18
ccs 6
cts 11
cp 0.5455
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 15 2
1
<?php
2
3
namespace Basis\Job\Tarantool;
4
5
use Basis\Filesystem;
6
use Basis\Job;
7
use Tarantool\Mapper\Mapper;
8
9
class Cache extends Job
10
{
11 1
    public function run(Mapper $mapper, Filesystem $fs)
12
    {
13 1
        $filename = $fs->getPath('.cache/mapper-meta.php');
14
15 1
        $dir = dirname($filename);
16 1
        if (!is_dir($dir)) {
17 1
            mkdir($dir);
18 1
            chown($dir, 'www-data');
19
            chgrp($dir, 'www-data');
20
        }
21
22
        file_put_contents($filename, '<?php return '.var_export($mapper->getMeta(), true).';');
23
        chown($filename, 'www-data');
24
        chgrp($filename, 'www-data');
25
    }
26
}
27