EmptyDir   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 2

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 4 1
A handle() 0 12 3
1
<?php
2
3
namespace League\Flysystem\Plugin;
4
5
class EmptyDir extends AbstractPlugin
6
{
7
    /**
8
     * Get the method name.
9
     *
10
     * @return string
11
     */
12 3
    public function getMethod()
13
    {
14 3
        return 'emptyDir';
15
    }
16
17
    /**
18
     * Empty a directory's contents.
19
     *
20
     * @param $dirname
21
     */
22 3
    public function handle($dirname)
23
    {
24 3
        $listing = $this->filesystem->listContents($dirname, false);
25
26 3
        foreach ($listing as $item) {
27 3
            if ($item['type'] === 'dir') {
28 3
                $this->filesystem->deleteDir($item['path']);
29 3
            } else {
30 3
                $this->filesystem->delete($item['path']);
31
            }
32 3
        }
33 3
    }
34
}
35