Completed
Push — master ( d56030...743cec )
by ignace nyamagana
02:52
created

ImmutableComponentTrait::__unset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 InvalidArgumentException;
15
use League\Uri\Interfaces\UriPart;
16
17
/**
18
 * Common methods for Component Value Object
19
 *
20
 * @package League.uri
21
 * @author  Ignace Nyamagana Butera <[email protected]>
22
 * @since   4.0.0
23
 */
24
trait ImmutableComponentTrait
25
{
26
    use ValidatorTrait;
27
    use TranscoderTrait;
28
29
    /**
30
     * DEPRECATION WARNING! This method will be removed in the next major point release
31
     *
32
     * @deprecated deprecated since version 4.2
33
     *
34
     * Returns whether two UriPart objects represent the same value
35
     * The comparison is based on the getUriComponent method
36
     *
37
     * @param UriPart $component
38
     *
39
     * @return bool
40
     */
41
    public function sameValueAs(UriPart $component)
42
    {
43
        return $component->getUriComponent() === $this->getUriComponent();
44
    }
45
46
    /**
47
     * Returns the instance string representation
48
     * with its optional URI delimiters
49
     *
50
     * @return string
51
     */
52
    abstract public function getUriComponent();
53
54
    /**
55
     * @inheritdoc
56
     */
57
    public function __set($property, $value)
58
    {
59
        throw new InvalidArgumentException(sprintf('%s is an undefined property', $property));
60
    }
61
62
    /**
63
     * @inheritdoc
64
     */
65
    public function __unset($property)
66
    {
67
        throw new InvalidArgumentException(sprintf('%s is an undefined property', $property));
68
    }
69
}
70