1 | <?php |
||
8 | class LabelFileFactory |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $labelDir; |
||
14 | |||
15 | /** |
||
16 | * @var Client |
||
17 | */ |
||
18 | protected $pakkelabelsClient; |
||
19 | |||
20 | public function __construct(Client $client, string $labelDir) |
||
25 | |||
26 | /** |
||
27 | * @param Label $label |
||
28 | * |
||
29 | * @return LabelFile |
||
30 | */ |
||
31 | public function create(Label $label): LabelFile |
||
32 | { |
||
33 | $file = new LabelFile($this->labelDir.'/'.$label->getId().'.png', 'w+'); |
||
34 | |||
35 | return $file; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @todo This is a bit wrong. This should probably be a service of some sort instead of being called a 'factory' |
||
40 | * |
||
41 | * @param Label $label |
||
42 | * @param bool $verifyExistence |
||
43 | * |
||
44 | * @return LabelFile |
||
45 | */ |
||
46 | public function read(Label $label, bool $verifyExistence = false): LabelFile |
||
70 | } |
||
71 |