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

ImmutableComponentTrait::assertValidComponent()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 3
eloc 3
nc 2
nop 1
crap 3

1 Method

Rating   Name   Duplication   Size   Complexity  
ImmutableComponentTrait::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