diff options
author | Fbenas <philbeansburton@gmail.com> | 2018-05-07 15:02:39 +0100 |
---|---|---|
committer | Fbenas <philbeansburton@gmail.com> | 2018-05-07 15:02:39 +0100 |
commit | 8350b6bd36d3a4bb3a99dfbf67e746f4f815927c (patch) | |
tree | d7cf04d2343ca031a8f241f204e4227eb6b48016 /src/Script/Input.php | |
parent | 33f00442f1667d57f94433834e0da4985670025b (diff) |
Add some simple exception handling for bad inputs
Diffstat (limited to 'src/Script/Input.php')
-rw-r--r-- | src/Script/Input.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Script/Input.php b/src/Script/Input.php index 4e437dd..772bb8c 100644 --- a/src/Script/Input.php +++ b/src/Script/Input.php @@ -63,6 +63,14 @@ class Input if ((array_key_exists('d', $this->options) <=> array_key_exists('t', $this->options)) !== 0) { throw new Exception('Both day and time options (`-d` and `-t`) are required for time based filtering'); } + + if (array_key_exists('c', $this->options) && !is_numeric($this->options['c'])) { + throw new Exception('Value for option `-c` must be an integer'); + } + + if (array_key_exists('l', $this->options) && is_numeric($this->options['l'])) { + throw new Exception('Value for option `-l` must be a string'); + } } /** |