1<?php
2
3/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5/**
6 * Condition set
7 *
8 * Note: This object currently focuses on repository objects as targets. It does not make use of the SHARED_CONDITIONS mode (ref_handling will be 1 for these items).
9 *
10 * @author killing@leifos.de
11 * @ingroup ServicesConditions
12 */
13class ilConditionSet
14{
15    /**
16     * @var bool
17     */
18    protected $hidden_status;
19
20    /**
21     * @var bool
22     */
23    protected $all_obligatory;
24
25    /**
26     * @var ilCondition[]
27     */
28    protected $conditions;
29
30    /**
31     * @var int
32     */
33    protected $num_obligatory;
34
35    /**
36     * Constructor
37     */
38    public function __construct(array $conditions)
39    {
40        $this->conditions = $conditions;
41    }
42
43    /**
44     * Get conditions
45     *
46     * @return ilCondition[] conditions
47     */
48    public function getConditions()
49    {
50        return $this->conditions;
51    }
52
53    /**
54     * Set hidden status (trigger objects should be hidden in presentation)
55     *
56     * @param bool $hidden_status hidden status
57     * @return self
58     */
59    public function withHiddenStatus($hidden_status)
60    {
61        $clone = clone $this;
62        $clone->hidden_status = $hidden_status;
63        return $clone;
64    }
65
66    /**
67     * Get hidden status
68     *
69     * @return bool hidden status
70     */
71    public function getHiddenStatus()
72    {
73        return $this->hidden_status;
74    }
75
76    /**
77     * Set all conditions being obligatory (standard behaviour)
78     */
79    public function withAllObligatory()
80    {
81        $clone = clone $this;
82        $clone->all_obligatory = true;
83        return $clone;
84    }
85
86    /**
87     * Get with all obligatory
88     *
89     * @return bool with all obligatory
90     */
91    public function getAllObligatory()
92    {
93        return $this->all_obligatory;
94    }
95
96    /**
97     * Set number of obligatory conditions
98     *
99     * @param int $num_obligatory number of obligatory conditions
100     * @return self
101     */
102    public function withNumObligatory($num_obligatory)
103    {
104        $clone = clone $this;
105        $clone->num_obligatory = $num_obligatory;
106        return $clone;
107    }
108
109    /**
110     * Get number of obligatory conditions
111     *
112     * @return int number of obligatory conditions
113     */
114    public function getNumObligatory()
115    {
116        return $this->num_obligatory;
117    }
118}
119