@@ 329-348 (lines=20) @@ | ||
326 | * @throws \RuntimeException |
|
327 | * @since 2.0.0 |
|
328 | */ |
|
329 | public function set($key, $value) |
|
330 | { |
|
331 | if ($this->readOnly) |
|
332 | { |
|
333 | throw new \RuntimeException('Changing values on this Data Container is not allowed.'); |
|
334 | } |
|
335 | ||
336 | $this->isModified = true; |
|
337 | ||
338 | if ($key === null) |
|
339 | { |
|
340 | $this->data[] = $value; |
|
341 | ||
342 | return $this; |
|
343 | } |
|
344 | ||
345 | Arr::set($this->data, $key, $value); |
|
346 | ||
347 | return $this; |
|
348 | } |
|
349 | ||
350 | /** |
|
351 | * Delete data from the container |
|
@@ 357-372 (lines=16) @@ | ||
354 | * @return boolean delete success boolean |
|
355 | * @since 2.0.0 |
|
356 | */ |
|
357 | public function delete($key) |
|
358 | { |
|
359 | if ($this->readOnly) |
|
360 | { |
|
361 | throw new \RuntimeException('Changing values on this Data Container is not allowed.'); |
|
362 | } |
|
363 | ||
364 | $this->isModified = true; |
|
365 | ||
366 | if (($result = Arr::delete($this->data, $key)) === false and $this->parentEnabled) |
|
367 | { |
|
368 | $result = $this->parent->delete($key); |
|
369 | } |
|
370 | ||
371 | return $result; |
|
372 | } |
|
373 | ||
374 | /** |
|
375 | * Allow usage of isset() on the param bag as an array |