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

ImmutableComponentTrait::sameValueAs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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