Ftpd::listDirectoryContents()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.2
cc 4
eloc 5
nc 2
nop 2
crap 4
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