@@ 134-141 (lines=8) @@ | ||
131 | return $this->attributes; |
|
132 | } |
|
133 | ||
134 | public function getAttribute($attribute, $default = null) |
|
135 | { |
|
136 | if (false === \array_key_exists($attribute, $this->attributes)) { |
|
137 | return $default; |
|
138 | } |
|
139 | ||
140 | return $this->attributes[$attribute]; |
|
141 | } |
|
142 | ||
143 | public function withAttribute($attribute, $value): self |
|
144 | { |
|
@@ 151-161 (lines=11) @@ | ||
148 | return $new; |
|
149 | } |
|
150 | ||
151 | public function withoutAttribute($attribute): self |
|
152 | { |
|
153 | if (false === \array_key_exists($attribute, $this->attributes)) { |
|
154 | return $this; |
|
155 | } |
|
156 | ||
157 | $new = clone $this; |
|
158 | unset($new->attributes[$attribute]); |
|
159 | ||
160 | return $new; |
|
161 | } |
|
162 | } |
|
163 |