| Conditions | 8 |
| Paths | 128 |
| Total Lines | 54 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 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 |
||
| 30 | protected function construct () { |
||
| 31 | $this->config = $this->load_config(); |
||
| 32 | _include_once(DIR.'/config/main.php', false); |
||
| 33 | defined('DEBUG') || define('DEBUG', false); |
||
| 34 | defined('DOMAIN') || define('DOMAIN', $this->config['domain']); |
||
| 35 | date_default_timezone_set($this->config['timezone']); |
||
| 36 | if (!is_dir(PUBLIC_STORAGE)) { |
||
| 37 | @mkdir(PUBLIC_STORAGE, 0775, true); |
||
| 38 | file_put_contents( |
||
| 39 | PUBLIC_STORAGE.'/.htaccess', |
||
| 40 | 'Allow From All |
||
| 41 | <ifModule mod_headers.c> |
||
| 42 | Header always append X-Frame-Options DENY |
||
| 43 | Header set Content-Type application/octet-stream |
||
| 44 | </ifModule> |
||
| 45 | ' |
||
| 46 | ); |
||
| 47 | } |
||
| 48 | if (!is_dir(CACHE)) { |
||
| 49 | @mkdir(CACHE, 0770); |
||
| 50 | } |
||
| 51 | if (!is_dir(PUBLIC_CACHE)) { |
||
| 52 | @mkdir(PUBLIC_CACHE, 0770); |
||
| 53 | file_put_contents( |
||
| 54 | PUBLIC_CACHE.'/.htaccess', |
||
| 55 | '<FilesMatch "\.(css|js|html)$"> |
||
| 56 | Allow From All |
||
| 57 | </FilesMatch> |
||
| 58 | <ifModule mod_expires.c> |
||
| 59 | ExpiresActive On |
||
| 60 | ExpiresDefault "access plus 1 month" |
||
| 61 | </ifModule> |
||
| 62 | <ifModule mod_headers.c> |
||
| 63 | Header set Cache-Control "max-age=2592000, public" |
||
| 64 | </ifModule> |
||
| 65 | AddEncoding gzip .js |
||
| 66 | AddEncoding gzip .css |
||
| 67 | AddEncoding gzip .html |
||
| 68 | ' |
||
| 69 | ); |
||
| 70 | } |
||
| 71 | if (!is_dir(LOGS)) { |
||
| 72 | @mkdir(LOGS, 0770); |
||
| 73 | } |
||
| 74 | if (!is_dir(TEMP)) { |
||
| 75 | @mkdir(TEMP, 0775); |
||
| 76 | file_put_contents( |
||
| 77 | TEMP.'/.htaccess', |
||
| 78 | "Allow From All\n" |
||
| 79 | ); |
||
| 80 | } |
||
| 81 | $this->fill_post_request(); |
||
| 82 | $this->constructed = true; |
||
| 83 | } |
||
| 84 | /** |
||
| 170 |