Cli   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A doRun() 0 13 3
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 15
    protected function doRun(Code $code)
23
    {
24 15
        $file = $this->createTemporaryFile();
25 15
        $code->writeTo($file);
26
27 15
        $process = new Process([PHP_BINARY ?: "php", $file]);
28 15
        $process->run();
29
30 15
        if (!@unlink($file)) {
31
            $this->logger->debug(sprintf('CLI: Could not delete file: %s', $file));
32
        }
33
34 15
        return $process->getOutput();
35
    }
36
}
37