1<?php
2
3declare(strict_types=1);
4
5/**
6 * Settings for an LSO (like abstract, extro)
7 *
8 * @author Nils Haagen <nils.haagen@concepts-and-training.de>
9 */
10class ilLearningSequenceSettings
11{
12
13    /**
14     * @var int
15     */
16    protected $obj_id;
17
18    /**
19     * @var string
20     */
21    protected $abstract;
22
23    /**
24     * @var string
25     */
26    protected $extro;
27
28    /**
29     * @var string|null
30     */
31    protected $abstract_image;
32
33    /**
34     * @var string|null
35     */
36    protected $extro_image;
37
38    /**
39     * @var array
40     */
41    protected $uploads = [];
42
43    /**
44     * @var array
45     */
46    protected $deletions = [];
47
48    /**
49     * @var bool
50     */
51    protected $members_gallery;
52
53
54    public function __construct(
55        int $obj_id,
56        string $abstract = '',
57        string $extro = '',
58        string $abstract_image = null,
59        string $extro_image = null,
60        bool $members_gallery = false
61    ) {
62        $this->obj_id = $obj_id;
63        $this->abstract = $abstract;
64        $this->extro = $extro;
65        $this->abstract_image = $abstract_image;
66        $this->extro_image = $extro_image;
67        $this->members_gallery = $members_gallery;
68    }
69
70    public function getObjId() : int
71    {
72        return $this->obj_id;
73    }
74
75    public function getAbstract() : string
76    {
77        return $this->abstract;
78    }
79
80    public function withAbstract(string $abstract) : ilLearningSequenceSettings
81    {
82        $clone = clone $this;
83        $clone->abstract = $abstract;
84        return $clone;
85    }
86
87    public function getExtro() : string
88    {
89        return $this->extro;
90    }
91
92    public function withExtro(string $extro) : ilLearningSequenceSettings
93    {
94        $clone = clone $this;
95        $clone->extro = $extro;
96        return $clone;
97    }
98
99    public function getAbstractImage()
100    {
101        return $this->abstract_image;
102    }
103
104    public function withAbstractImage(string $path = null) : ilLearningSequenceSettings
105    {
106        $clone = clone $this;
107        $clone->abstract_image = $path;
108        return $clone;
109    }
110
111    public function getExtroImage()
112    {
113        return $this->extro_image;
114    }
115
116    public function withExtroImage(string $path = null) : ilLearningSequenceSettings
117    {
118        $clone = clone $this;
119        $clone->extro_image = $path;
120        return $clone;
121    }
122
123    public function getUploads() : array
124    {
125        return $this->uploads;
126    }
127
128    public function withUpload(array $upload_info, string $which) : ilLearningSequenceSettings
129    {
130        $clone = clone $this;
131        $clone->uploads[$which] = $upload_info;
132        return $clone;
133    }
134
135    public function getDeletions() : array
136    {
137        return $this->deletions;
138    }
139
140    public function withDeletion(string $which) : ilLearningSequenceSettings
141    {
142        $clone = clone $this;
143        $clone->deletions[] = $which;
144        return $clone;
145    }
146
147    public function getMembersGallery() : bool
148    {
149        return $this->members_gallery;
150    }
151
152    public function withMembersGallery(bool $members_gallery) : ilLearningSequenceSettings
153    {
154        $clone = clone $this;
155        $clone->members_gallery = $members_gallery;
156        return $clone;
157    }
158}
159