1 | <?php |
||
14 | abstract class SaveEnvVariable extends Command |
||
15 | { |
||
16 | use DiesIfNoEnvFileExists, InteractsWithEnvironment; |
||
17 | |||
18 | /** |
||
19 | * Env var to set. |
||
20 | * |
||
21 | * @return mixed |
||
22 | */ |
||
23 | abstract protected function envVar(); |
||
24 | |||
25 | /** |
||
26 | * Argument key. |
||
27 | * |
||
28 | * @return mixed |
||
29 | */ |
||
30 | abstract protected function argKey(); |
||
31 | |||
32 | /** |
||
33 | * Question text. |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | abstract protected function questionText(); |
||
38 | |||
39 | /** |
||
40 | * SaveEnvVariable constructor. |
||
41 | * |
||
42 | */ |
||
43 | public function __construct() |
||
47 | |||
48 | /** |
||
49 | * Execute the console command. |
||
50 | * |
||
51 | */ |
||
52 | public function handle() |
||
70 | |||
71 | /** |
||
72 | * Before. |
||
73 | */ |
||
74 | protected function before() |
||
78 | |||
79 | /** |
||
80 | * After. |
||
81 | */ |
||
82 | protected function after() |
||
86 | |||
87 | /** |
||
88 | * Get value. |
||
89 | * |
||
90 | * @return array|string |
||
91 | */ |
||
92 | protected function value() |
||
96 | |||
97 | /** |
||
98 | * Check if command have to be skipped. |
||
99 | */ |
||
100 | protected function checkIfCommandHaveToBeSkipped() |
||
104 | |||
105 | /** |
||
106 | * Default. |
||
107 | */ |
||
108 | protected function default() |
||
112 | } |
||
113 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.