Completed
Push — master ( aa9408...5b12df )
by ignace nyamagana
03:43
created

Ftp::assertSupportedScheme()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 2
eloc 4
c 1
b 1
f 0
nc 2
nop 0
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 2
rs 9.4285
1
<?php
2
/**
3
 * League.Uri (http://uri.thephpleague.com)
4
 *
5
 * @package   League.uri
6
 * @author    Ignace Nyamagana Butera <[email protected]>
7
 * @copyright 2013-2015 Ignace Nyamagana Butera
8
 * @license   https://github.com/thephpleague/uri/blob/master/LICENSE (MIT License)
9
 * @version   4.2.0
10
 * @link      https://github.com/thephpleague/uri/
11
 */
12
namespace League\Uri\Schemes;
13
14
use League\Uri\Interfaces\Uri;
15
use League\Uri\Schemes\Generic\AbstractHierarchicalUri;
16
17
/**
18
 * Value object representing FTP Uri.
19
 *
20
 * @package League.uri
21
 * @author  Ignace Nyamagana Butera <[email protected]>
22
 * @since   4.0.0
23
 */
24
class Ftp extends AbstractHierarchicalUri implements Uri
25
{
26
    /**
27
     * @inheritdoc
28
     */
29
    protected static $supportedSchemes = [
30
        'ftp' => 21,
31
    ];
32
33
    /**
34
     * @inheritdoc
35
     */
36 30
    protected function assertSupportedScheme()
37
    {
38 30
        $scheme = $this->getScheme();
39 30
        if ('' !== $scheme) {
40 18
            parent::assertSupportedScheme();
41 8
        }
42 24
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47 33
    protected function isValid()
48
    {
49 33
        return null === $this->fragment->getContent()
50 33
            && null === $this->query->getContent()
51 33
            && $this->isValidGenericUri()
52 33
            && $this->isValidHierarchicalUri();
53
    }
54
}
55