| 1 | <?php |
||
| 15 | final class Core { |
||
| 16 | /** |
||
| 17 | * @var \GV\Core The \GV\Core static instance. |
||
| 18 | */ |
||
| 19 | private static $__instance = null; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var \GV\Plugin The WordPress plugin context. |
||
| 23 | * |
||
| 24 | * @api |
||
| 25 | * @since future |
||
| 26 | */ |
||
| 27 | public $plugin; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var \GV\Request The current request. |
||
| 31 | * |
||
| 32 | * @api |
||
| 33 | * @since future |
||
| 34 | */ |
||
| 35 | public $request; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var \GV\CoreSettings core GravityView settings |
||
| 39 | */ |
||
| 40 | public $settings; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the global instance of \GV\Core. |
||
| 44 | * |
||
| 45 | * @return \GV\Core The global instance of GravityView Core. |
||
| 46 | */ |
||
| 47 | public static function get() { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Bootstrap. |
||
| 55 | * |
||
| 56 | * @return void |
||
| 57 | */ |
||
| 58 | private function __construct() { |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Early initialization. |
||
| 64 | * |
||
| 65 | * Loads dependencies, sets up the object, adds hooks, etc. |
||
| 66 | * |
||
| 67 | * @return void |
||
| 68 | */ |
||
| 69 | private function init() { |
||
| 73 | |||
| 74 | private function __clone() { } |
||
| 75 | |||
| 76 | private function __wakeup() { } |
||
| 77 | } |
||
| 78 |
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.