-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPresentation.php
More file actions
38 lines (31 loc) · 1.12 KB
/
Presentation.php
File metadata and controls
38 lines (31 loc) · 1.12 KB
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
<?php
namespace Imaarov\Patterns\Creational\Builder;
use Imaarov\Patterns\Creational\Builder\Enum\PresentationFormatEnum;
use Imaarov\Patterns\Creational\Builder\Interface\PresentationBuilderInterface;
class Presentation {
private array $slides;
public function addSlides(Slide $slide)
{
array_push($this->slides, $slide);
}
public function export(PresentationBuilderInterface $builder) : void
{
# instead of this
// if($presentationFormatEnum == PresentationFormatEnum::PDF) {
// $pdf = new PdfDocument();
// foreach ($this->slides as $key => $slide) {
// $pdf->addPage($slide->getText());
// }
// }else if($presentationFormatEnum == PresentationFormatEnum::MOVIE) {
// $movie = new Movie();
// foreach ($this->slides as $key => $slide) {
// $movie->addFrame($slide->getText(), 1);
// }
// }
# use Factory
$builder->addSlide(new Slide("copyright"));
foreach ($this->slides as $key => $slide) {
$builder->addSlide($slide);
}
}
}