@@ 40-47 (lines=8) @@ | ||
37 | * |
|
38 | * @throws \Exception |
|
39 | */ |
|
40 | public function delete($key) |
|
41 | { |
|
42 | if (isset($this->data[$key])) { |
|
43 | unset($this->data[$key]); |
|
44 | } else { |
|
45 | throw new \Exception("Invalid key $key."); |
|
46 | } |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * Returns object from collection. |
|
@@ 58-65 (lines=8) @@ | ||
55 | * |
|
56 | * @throws \Exception |
|
57 | */ |
|
58 | public function get($key) |
|
59 | { |
|
60 | if (isset($this->data[$key])) { |
|
61 | return $this->data[$key]; |
|
62 | } else { |
|
63 | throw new \Exception("Invalid key $key."); |
|
64 | } |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * Checks if object with given key exists in collection. |