From 19564c9e18ae456e39bc2c8a306f9e79dd619e11 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Mon, 7 May 2018 15:24:00 +0100 Subject: Docblock and fix toString functions --- src/Model/Menu.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'src/Model/Menu.php') diff --git a/src/Model/Menu.php b/src/Model/Menu.php index d0a281e..3fea03f 100644 --- a/src/Model/Menu.php +++ b/src/Model/Menu.php @@ -6,14 +6,40 @@ use App\Model\Model; /** * Menu Model + * + * @author Phil Burton */ class Menu extends Model { + /** + * Name of this menu + * + * @var string + */ protected $name; + + /** + * Allergies string + * + * @var string + */ protected $allergies; - protected $advanceTime; + /** + * Required advanced notice time in horus for this menu + * + * @var int + */ + protected $advanceTime; + /** + * Set the class attributes + * + * @author Phil Burton + * @param $name + * @param $allergies + * @param $advanceTime + */ public function __construct($name, $allergies, $advanceTime) { $this->name = $name; @@ -21,17 +47,36 @@ class Menu extends Model $this->setTime($advanceTime); } + /** + * Set the time removing the `h` if given + * e.g. 12h becomes 12 + * + * @author Phil Burton + * @param mixed $time + */ public function setTime($time) { $this->advanceTime = str_replace('h', '', $time); } + /** + * Returbn the advancedd time + * + * @author Phil Burton + * @return int + */ public function getAdvanceTime(): int { return $this->advanceTime; } - public function toString() + /** + * Return a string representation of this menu + * + * @author Phil Burton + * @return string + */ + public function toString(): string { return $this->name . ';' . $this->allergies; } -- cgit v1.2.3