Ftpd   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 1

Complexity

Total Complexity 9

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 36
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B getMetadata() 0 16 5
A listDirectoryContents() 0 10 4
1
<?php
2
3
namespace League\Flysystem\Adapter;
4
5
class Ftpd extends Ftp
6
{
7
    /**
8
     * @inheritdoc
9
     */
10 9
    public function getMetadata($path)
11
    {
12 9
        if ($path === '') {
13 3
            return ['type' => 'dir', 'path' => ''];
14
        }
15
16 6
        if (! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) {
17 3
            return false;
18
        }
19
20 6
        if (substr($object[1], 0, 5) === "ftpd:") {
21 3
            return false;
22
        }
23
24 6
        return $this->normalizeObject($object[1], '');
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 6
    protected function listDirectoryContents($directory, $recursive = true)
31
    {
32 6
        $listing = ftp_rawlist($this->getConnection(), $directory, $recursive);
33
34 6
        if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) {
35 3
            return [];
36
        }
37
38 3
        return $this->normalizeListing($listing, $directory);
39
    }
40
}
41