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

Ws::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 WS and WSS Uri.
19
 *
20
 * @package League.uri
21
 * @author  Ignace Nyamagana Butera <[email protected]>
22
 * @since   4.0.0
23
 */
24
class Ws extends AbstractHierarchicalUri implements Uri
25
{
26
    /**
27
     * @inheritdoc
28
     */
29
    protected static $supportedSchemes = [
30
        'ws' => 80,
31
        'wss' => 443,
32
    ];
33
34
    /**
35
     * @inheritdoc
36
     */
37 30
    protected function assertSupportedScheme()
38
    {
39 30
        $scheme = $this->getScheme();
40 30
        if ('' !== $scheme) {
41 18
            parent::assertSupportedScheme();
42 8
        }
43 24
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48 33
    protected function isValid()
49
    {
50 33
        return null === $this->fragment->getContent()
51 33
            && $this->isValidGenericUri()
52 33
            && $this->isValidHierarchicalUri();
53
    }
54
}
55