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

Ws   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 0
Metric Value
c 4
b 2
f 0
dl 0
loc 31
ccs 10
cts 10
cp 1
rs 10
wmc 5
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A assertSupportedScheme() 0 7 2
A isValid() 0 6 3
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