Completed
Push — 1.x ( 2f995a...fa8c59 )
by Samuel
18:04
created

Cli   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
c 3
b 0
f 0
lcom 0
cbo 3
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A doRun() 0 12 1
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
    protected function doRun(Code $code)
23
    {
24
        $file = $this->createTemporaryFile();
25
        $code->writeTo($file);
26
27
        $process = new Process("php $file");
28
        $process->run();
29
30
        @unlink($file);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
31
32
        return $process->getOutput();
33
    }
34
}
35