Conditions | 12 |
Paths | 8 |
Total Lines | 30 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
107 | private function _runAdminer() |
||
108 | { |
||
109 | if (!isset($_GET['username']) && !isset($_POST['auth']) |
||
110 | && config('lumener.auto_login') |
||
111 | && !$this->request->cookie('adminer_logged_out')) { |
||
112 | // Skip login screen |
||
113 | $_GET['username'] = |
||
114 | config('lumener.db.username', env("DB_USERNAME")); |
||
115 | $_GET['db'] = |
||
116 | config('lumener.db.database', env("DB_DATABASE")); |
||
117 | // Password is set in the adminer extension |
||
118 | } |
||
119 | // Security Check |
||
120 | $this->allowed_dbs = config('lumener.security.allowed_db'); |
||
121 | $this->protected_dbs = config('lumener.security.protected_db'); |
||
122 | |||
123 | if ((isset($_GET['db']) && $_GET['db'] |
||
124 | && $this->isDBBlocked($_GET['db'])) |
||
125 | || (isset($_POST['auth']['db']) && $_POST['auth']['db'] |
||
126 | && $this->isDBBlocked($_POST['auth']['db']))) { |
||
127 | abort(403); |
||
128 | } |
||
129 | |||
130 | $content = |
||
131 | $this->_runGetBuffer([$this->adminer_object, $this->adminer]); |
||
132 | |||
133 | if (strpos($content, "<!DOCTYPE html>") === false) { |
||
134 | die($content); |
||
1 ignored issue
–
show
|
|||
135 | } |
||
136 | return $content; |
||
137 | } |
||
161 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.