DeleteStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 12 2
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2014-06-07
5
 */
6
7
namespace Net\Bazzline\Component\Locator\FileExistsStrategy;
8
9
/**
10
 * Class DeleteStrategy
11
 * @package Net\Bazzline\Component\Locator\FileExistsStrategy
12
 */
13
class DeleteStrategy extends AbstractStrategy
14
{
15
    /**
16
     * @throws RuntimeException
17
     */
18
    public function execute()
19
    {
20
        $fullQualifiedFilePath = $this->getFilePath() . DIRECTORY_SEPARATOR .
21
            $this->getFileName();
22
        $fileCouldNotBeRemoved = (unlink($fullQualifiedFilePath) !== true);
23
24
        if ($fileCouldNotBeRemoved) {
25
            throw new RuntimeException(
26
                'could not delete file "' . $fullQualifiedFilePath . '"'
27
            );
28
        }
29
    }
30
}