Completed
Push — cmd-clean ( 91e3b7 )
by Arnaud
01:45
created

Clean   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A processCommand() 0 15 3
1
<?php
2
/*
3
 * This file is part of the PHPoole package.
4
 *
5
 * Copyright (c) Arnaud Ligny <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace PHPoole\Command;
12
13
use PHPoole\PHPoole;
14
use PHPoole\Command\Serve;
15
16
class Clean extends AbstractCommand
17
{
18
    public function processCommand()
19
    {
20
        //delete output dir
21
        $outputDir = $this->getPHPoole()->getConfig()->get('output.dir');
22
        if ($this->fs->exists($this->getPath().'/'.$outputDir)) {
23
            $this->fs->remove($this->getPath().'/'.$outputDir);
24
            $this->wlDone(sprintf("Output directory '%s' removed.", $outputDir));
25
        }
26
        // delete server temp files
27
        if ($this->fs->exists($this->getPath().'/'.Serve::$tmpDir)) {
28
            $this->fs->remove($this->getPath().'/'.Serve::$tmpDir);
29
            $this->wlDone('Temporary server files deleted.');
30
        }
31
        exit(0);
32
    }
33
}
34