@@ 44-53 (lines=10) @@ | ||
41 | * @return $this For method chaining |
|
42 | * @throws \InvalidArgumentException if key type is not a string or integer |
|
43 | */ |
|
44 | public function setOption($key, $value) |
|
45 | { |
|
46 | if (is_int($key) || is_string($key)) { |
|
47 | $this->options[$key] = $value; |
|
48 | } else { |
|
49 | throw new \InvalidArgumentException('Option key must be an integer or string. ' . gettype($key) . ' given'); |
|
50 | } |
|
51 | ||
52 | return $this; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * Set a group of options at the same time |
|
@@ 62-71 (lines=10) @@ | ||
59 | * @return $this For method chaining |
|
60 | * @throws \InvalidArgumentException If input is not an array |
|
61 | */ |
|
62 | public function setOptions($options) |
|
63 | { |
|
64 | if (is_array($options)) { |
|
65 | $this->options = array_merge($this->options, $options); |
|
66 | } else { |
|
67 | throw new \InvalidArgumentException('Options must be an array. ' . gettype($options) . ' given'); |
|
68 | } |
|
69 | ||
70 | return $this; |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * Get the value of a single option or return false if it doesn't exist |