| @@ 33-44 (lines=12) @@ | ||
| 30 | * @throws OutOfBoundsException |
|
| 31 | * @return mixed |
|
| 32 | */ |
|
| 33 | public function get($key) |
|
| 34 | { |
|
| 35 | if (isset($this->overrides[$key])) { |
|
| 36 | return $this->overrides[$key]; |
|
| 37 | } |
|
| 38 | ||
| 39 | if (isset($this->defaults[$key])) { |
|
| 40 | return $this->defaults[$key]; |
|
| 41 | } |
|
| 42 | ||
| 43 | throw new OutOfBoundsException("The given key '$key' was not present in the settings."); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Returns the value for the $key searching through overrides and defaults. Returns null if not found. |
|
| @@ 53-64 (lines=12) @@ | ||
| 50 | * |
|
| 51 | * @return mixed |
|
| 52 | */ |
|
| 53 | public function tryGet($key) |
|
| 54 | { |
|
| 55 | if (isset($this->overrides[$key])) { |
|
| 56 | return $this->overrides[$key]; |
|
| 57 | } |
|
| 58 | ||
| 59 | if (isset($this->defaults[$key])) { |
|
| 60 | return $this->defaults[$key]; |
|
| 61 | } |
|
| 62 | ||
| 63 | return null; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Returns true if there is an override or a default value for $key |
|