1 | <?php |
||
19 | class DisplayTabbed implements DisplayInterface, FormInterface |
||
20 | { |
||
21 | use FormElements, VisibleCondition, \SleepingOwl\Admin\Traits\Renderable; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $view = 'display.tabbed'; |
||
27 | |||
28 | /** |
||
29 | * DisplayTabbed constructor. |
||
30 | * |
||
31 | * @param Closure|TabInterface[] $tabs |
||
32 | */ |
||
33 | public function __construct($tabs = null) |
||
41 | |||
42 | public function initialize() |
||
54 | |||
55 | /** |
||
56 | * @param string $class |
||
57 | */ |
||
58 | public function setModelClass($class) |
||
66 | |||
67 | /** |
||
68 | * @return TabInterface[]|DisplayTabsCollection |
||
69 | */ |
||
70 | public function getTabs() |
||
74 | |||
75 | /** |
||
76 | * @param Closure|TabInterface[] $tabs |
||
77 | * |
||
78 | * @return $this |
||
79 | */ |
||
80 | public function setTabs($tabs) |
||
88 | |||
89 | /** |
||
90 | * @param array $elements |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function setElements(array $elements) |
||
106 | |||
107 | /** |
||
108 | * @param Renderable $display |
||
109 | * @param string $label |
||
110 | * @param bool|false $active |
||
111 | * |
||
112 | * @return TabInterface |
||
113 | */ |
||
114 | public function appendTab(Renderable $display, $label, $active = false) |
||
122 | |||
123 | /** |
||
124 | * @param TabInterface $element |
||
125 | * |
||
126 | * @return $this |
||
127 | */ |
||
128 | public function addElement(TabInterface $element) |
||
134 | |||
135 | /** |
||
136 | * @param string $action |
||
137 | */ |
||
138 | public function setAction($action) |
||
146 | |||
147 | /** |
||
148 | * @param int $id |
||
149 | */ |
||
150 | public function setId($id) |
||
158 | |||
159 | /** |
||
160 | * @param ModelConfigurationInterface $model |
||
161 | * |
||
162 | * @return Validator|null |
||
163 | */ |
||
164 | public function validateForm(ModelConfigurationInterface $model) |
||
172 | |||
173 | /** |
||
174 | * @param ModelConfigurationInterface $model |
||
175 | */ |
||
176 | public function saveForm(ModelConfigurationInterface $model) |
||
184 | |||
185 | /** |
||
186 | * @return mixed |
||
187 | */ |
||
188 | public function getValue() |
||
191 | |||
192 | /** |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function isReadonly() |
||
199 | |||
200 | /** |
||
201 | * @return array |
||
202 | */ |
||
203 | public function toArray() |
||
209 | |||
210 | /** |
||
211 | * Using in trait FormElements;. |
||
212 | * |
||
213 | * @param $object |
||
214 | * |
||
215 | * @return mixed |
||
216 | */ |
||
217 | protected function getElementContainer($object) |
||
221 | |||
222 | /** |
||
223 | * @return Model $model |
||
224 | */ |
||
225 | public function getModel() |
||
233 | } |
||
234 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and
&&
or
||
The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&
, or||
.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
die
introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.