Completed
Push — master ( 4b40ba...4de594 )
by ignace nyamagana
03:31
created

ImmutableComponentTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 15
Bugs 1 Features 0
Metric Value
wmc 1
c 15
b 1
f 0
lcom 0
cbo 3
dl 0
loc 26
ccs 2
cts 2
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sameValueAs() 0 4 1
getUriComponent() 0 1 ?
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\Types;
13
14
use League\Uri\Interfaces\UriPart;
15
16
/**
17
 * Common methods for Component Value Object
18
 *
19
 * @package League.uri
20
 * @author  Ignace Nyamagana Butera <[email protected]>
21
 * @since   4.0.0
22
 */
23
trait ImmutableComponentTrait
24
{
25
    use ValidatorTrait;
26
    use TranscoderTrait;
27
28
    /**
29
     * Returns whether two UriPart objects represent the same value
30
     * The comparison is based on the getUriComponent method
31
     *
32
     * @param UriPart $component
33
     *
34
     * @return bool
35
     */
36 36
    public function sameValueAs(UriPart $component)
37
    {
38 36
        return $component->getUriComponent() === $this->getUriComponent();
39
    }
40
41
    /**
42
     * Returns the instance string representation
43
     * with its optional URI delimiters
44
     *
45
     * @return string
46
     */
47
    abstract public function getUriComponent();
48
}
49