1 | <?php |
||
23 | abstract class AbstractComponent |
||
24 | { |
||
25 | use ImmutableComponentTrait; |
||
26 | |||
27 | /** |
||
28 | * The component data |
||
29 | * |
||
30 | * @var int|string |
||
31 | */ |
||
32 | protected $data; |
||
33 | |||
34 | /** |
||
35 | * @inheritdoc |
||
36 | */ |
||
37 | 12 | public static function __set_state(array $properties) |
|
41 | |||
42 | /** |
||
43 | * new instance |
||
44 | * |
||
45 | * @param string|null $data the component value |
||
46 | */ |
||
47 | 1420 | public function __construct($data = null) |
|
51 | |||
52 | /** |
||
53 | * Validate the component string |
||
54 | * |
||
55 | * @param mixed $data |
||
56 | * |
||
57 | * @throws InvalidArgumentException if the component is no valid |
||
58 | * |
||
59 | * @return mixed |
||
60 | */ |
||
61 | 1084 | protected function validate($data) |
|
69 | |||
70 | |||
71 | /** |
||
72 | * The component raw data |
||
73 | * |
||
74 | * @return mixed |
||
75 | */ |
||
76 | 834 | public function getContent() |
|
80 | |||
81 | /** |
||
82 | * Returns the instance string representation; If the |
||
83 | * instance is not defined an empty string is returned |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | 1218 | public function __toString() |
|
91 | |||
92 | /** |
||
93 | * Returns the instance string representation |
||
94 | * with its optional URI delimiters |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 183 | public function getUriComponent() |
|
102 | |||
103 | /** |
||
104 | * Returns an instance with the specified string |
||
105 | * |
||
106 | * This method MUST retain the state of the current instance, and return |
||
107 | * an instance that contains the modified data |
||
108 | * |
||
109 | * @param string $value |
||
110 | * |
||
111 | * @return static |
||
112 | */ |
||
113 | 435 | public function modify($value) |
|
121 | } |
||
122 |