summaryrefslogtreecommitdiff
path: root/src/Model/Vendor.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/Vendor.php')
-rw-r--r--src/Model/Vendor.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Model/Vendor.php b/src/Model/Vendor.php
new file mode 100644
index 0000000..99a95dd
--- /dev/null
+++ b/src/Model/Vendor.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Model;
+
+use App\File\Handler as FileHandler;
+use App\Model\Collection;
+use App\Model\Model;
+use App\Script\Input;
+
+/**
+ * Vendor Model
+ */
+class Vendor extends Model
+{
+ protected $name;
+ protected $postcode;
+ protected $maxCovers;
+ protected $menus;
+
+ /**
+ * Load vendors from file, parse them into a model collection and Return
+ *
+ * @author Phil Burton <phil@pgburton.com>
+ * @param FileHandler $handler
+ * @return Collection
+ */
+ public function loadFromFile(FileHandler $handler): Collection
+ {
+ // initalise a Vendor Collection
+ $collection = new Collection;
+
+ foreach ($handler->getVendorArray() as $vendorRaw) {
+ $collection[] = new Vendor($vendorRaw);
+ }
+
+ return $collection;
+ }
+
+ /**
+ * Filter by input
+ *
+ * @author Phil Burton <phil@pgburton.com>
+ * @param Input $input
+ */
+ public function filterByInput(Input $input)
+ {
+ // Amend the colletion so we've filtered by the input
+ }
+}