1 | <?php |
||
18 | class ConsoleRoute extends BaseRoute |
||
19 | { |
||
20 | /** |
||
21 | * {@inheritdoc} |
||
22 | */ |
||
23 | public function __construct($name = null) |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function setPath($path) |
||
37 | |||
38 | /** |
||
39 | * Set route title |
||
40 | * |
||
41 | * @param string $title |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function setTitle($title) |
||
49 | |||
50 | /** |
||
51 | * Set route description |
||
52 | * |
||
53 | * @param string|array $description |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function setDescription($description) |
||
64 | |||
65 | /** |
||
66 | * @param array $description |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function setArgumentsDescription($description) |
||
74 | |||
75 | /** |
||
76 | * @param array $description |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function setOptionsDescription($description) |
||
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | public function toArray() |
||
92 | } |
||
93 |
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.