Completed
Pull Request — master (#444)
by Yanick
02:55
created

LiteSpeedProxy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 53
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A start() 0 9 1
A stop() 0 7 1
A clear() 0 19 1
1
<?php
2
3
/*
4
 * This file is part of the FOSHttpCache package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
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 FOS\HttpCache\Test\Proxy;
13
14
use Symfony\Component\Process\Exception\ProcessFailedException;
15
16
class LiteSpeedProxy extends AbstractProxy
17
{
18
    protected $binary = '/usr/local/lsws/bin/lswsctrl';
19
20
    protected $port = 8080;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function start()
26
    {
27
        $this->runCommand([
28
            $this->getBinary(),
29
            'start',
30
        ], true);
31
32
        $this->waitFor($this->getIp(), $this->getPort(), 2000);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function stop()
39
    {
40
        $this->runCommand([
41
            $this->getBinary(),
42
            'stop',
43
        ], true);
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function clear()
50
    {
51
        //try {
52
            $process = $this->runCommand([
53
                $this->getBinary(),
54
                'status',
55
            ], true);
56
57
            var_dump($process->getStatus());
0 ignored issues
show
Security Debugging Code introduced by
var_dump($process->getStatus()); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
58
            var_dump($process->getOutput());
59
            var_dump($process->getErrorOutput());
60
61
            //$this->stop();
62
        //} catch (ProcessFailedException $e) {
63
            // Not running, no need to stop
64
        //}
65
66
        $this->start();
67
    }
68
}
69