From 640fc0de633e297085582dd50d8b28362dcdd8f1 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Mon, 7 May 2018 15:55:10 +0100 Subject: Remove long opts and add design decisions to readme --- src/Script/Input.php | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) (limited to 'src') 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 * @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 - * @return string - */ - public function getLongOptionString(): array - { - return $this->longOpts; - } /** * Return an option value -- cgit v1.2.3