blob: 99a95dd4d10582e75d64faf05465cbe0886cf715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
}
}
|