summaryrefslogtreecommitdiff
path: root/src/Script
diff options
context:
space:
mode:
Diffstat (limited to 'src/Script')
-rw-r--r--src/Script/Input.php36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/Script/Input.php b/src/Script/Input.php
index 6a91a72..eb9d2da 100644
--- a/src/Script/Input.php
+++ b/src/Script/Input.php
@@ -21,25 +21,7 @@ class Input
*
* @var string
*/
- protected $shortOpts = 'f:d::t::l::c::';
-
- /**
- * Available CLI options
- * f filename - input file with the vendors data
- * d day - delivery day (dd/mm/yy)
- * t time - delivery time in 24h format (hh:mm)
- * l location - delivery location (postcode without spaces, e.g. NW43QB)
- * c covers - number of people to feed
- *
- * @var string
- */
- protected $longOpts = [
- 'filename:',
- 'day::',
- 'time::',
- 'location::',
- 'covers::'
- ];
+ protected $availableOptions = 'f:d::t::l::c::';
/**
* The loaded CLI options
@@ -66,7 +48,7 @@ class Input
*/
protected function loadOptions()
{
- $this->options = getopt($this->getShortOptionString(), $this->getLongOptionString());
+ $this->options = getopt($this->getOptionString());
if (!array_key_exists('f', $this->options)) {
throw new Exception('Filename Option `-f` is required');
@@ -92,21 +74,11 @@ class Input
* @author Phil Burton <phil@pgburton.com>
* @return string
*/
- public function getShortOptionString(): string
+ public function getOptionString(): string
{
- return $this->shortOpts;
+ return $this->availableOptions;
}
- /**
- * Return the option string for the options we want to load
- *
- * @author Phil Burton <phil@pgburton.com>
- * @return string
- */
- public function getLongOptionString(): array
- {
- return $this->longOpts;
- }
/**
* Return an option value