Ftpd::getMetadata()   B
last analyzed

Complexity

Conditions 5
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 5

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 8.8571
cc 5
eloc 6
nc 3
nop 1
crap 5
1
<?php
2
3
namespace League\Flysystem\Adapter;
4
5
class Ftpd extends Ftp
6
{
7
    /**
8
     * @inheritdoc
9
     */
10 6
    public function getMetadata($path)
11
    {
12 6
        if (empty($path) || ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) {
13 3
            return false;
14
        }
15
16 6
        if (substr($object[1], 0, 5) === "ftpd:") {
17 3
            return false;
18
        }
19
20 6
        return $this->normalizeObject($object[1], '');
21
    }
22
23
    /**
24
     * @inheritdoc
25
     */
26 6
    protected function listDirectoryContents($directory, $recursive = true)
27
    {
28 6
        $listing = ftp_rawlist($this->getConnection(), $directory, $recursive);
29
30 6
        if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) {
31 3
            return array();
32
        }
33
34 3
        return $this->normalizeListing($listing, $directory);
35
    }
36
}
37