Completed
Push — master ( f146ce...fa6bcb )
by Samuel
02:58 queued 30s
created

Cli   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 20
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A doRun() 0 14 2
1
<?php
2
3
/*
4
 * This file is part of CacheTool.
5
 *
6
 * (c) Samuel Gordalina <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CacheTool\Adapter;
13
14
use CacheTool\Code;
15
use Symfony\Component\Process\Process;
16
17
class Cli extends AbstractAdapter
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 2
    protected function doRun(Code $code)
23
    {
24 2
        $file = $this->createTemporaryFile();
25 2
        $code->writeTo($file);
26
27 2
        $process = new Process("php $file");
28 2
        $process->run();
29
30 2
        if (!@unlink($file)) {
31
            $this->logger->debug(sprintf('CLI: Could not delete file: %s', $file));
32
        }
33
34 2
        return $process->getOutput();
35
    }
36
}
37