1 | <?php |
||
19 | class DisplayTabbed implements DisplayInterface, FormInterface |
||
20 | { |
||
21 | use FormElements, VisibleCondition; |
||
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) |
||
175 | |||
176 | /** |
||
177 | * @param ModelConfigurationInterface $model |
||
178 | */ |
||
179 | public function saveForm(ModelConfigurationInterface $model) |
||
187 | |||
188 | /** |
||
189 | * @return mixed |
||
190 | */ |
||
191 | public function getValue() |
||
194 | |||
195 | /** |
||
196 | * @return bool |
||
197 | */ |
||
198 | public function isReadonly() |
||
202 | |||
203 | /** |
||
204 | * @return string |
||
205 | */ |
||
206 | public function getView() |
||
210 | |||
211 | /** |
||
212 | * @return array |
||
213 | */ |
||
214 | public function toArray() |
||
220 | |||
221 | /** |
||
222 | * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory |
||
223 | */ |
||
224 | public function render() |
||
231 | |||
232 | /** |
||
233 | * @return string |
||
234 | */ |
||
235 | public function __toString() |
||
239 | |||
240 | /** |
||
241 | * Using in trait FormElements;. |
||
242 | * |
||
243 | * @param $object |
||
244 | * |
||
245 | * @return mixed |
||
246 | */ |
||
247 | protected function getElementContainer($object) |
||
251 | |||
252 | /** |
||
253 | * @return Model $model |
||
254 | */ |
||
255 | public function getModel() |
||
263 | } |
||
264 |
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.