| 1 | <?php |
||
| 7 | class InitializersMakeCommand extends GeneratorCommand |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The name and signature of the console command. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $signature = 'make:initializers'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The console command description. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $description = 'Creates application update and installation config classes.'; |
||
| 22 | |||
| 23 | protected $type = 'Install config'; |
||
| 24 | |||
| 25 | protected $nameInput = 'Install'; |
||
| 26 | |||
| 27 | protected $stubFileName = 'install-config.stub'; |
||
| 28 | |||
| 29 | 3 | public function handle() |
|
| 41 | |||
| 42 | /** |
||
| 43 | * Get the stub file for the generator. |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 3 | protected function getStub() |
|
| 51 | |||
| 52 | /** |
||
| 53 | * Get the desired class name from the input. |
||
| 54 | * |
||
| 55 | * @return string |
||
| 56 | */ |
||
| 57 | 3 | protected function getNameInput() |
|
| 61 | } |
||
| 62 |
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
dieintroduces 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 withthrowat this point:These limitations lead to logical operators rarely being of use in current PHP code.