@@ -21,9 +21,13 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | private static function search(array &$list) { |
| 23 | 23 | |
| 24 | - if (empty($agent = getenv('HTTP_USER_AGENT'))) return false; |
|
| 24 | + if (empty($agent = getenv('HTTP_USER_AGENT'))) { |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | - foreach ($list as $item) if (false !== stripos($agent, $item)) return true; |
|
| 28 | + foreach ($list as $item) { |
|
| 29 | + if (false !== stripos($agent, $item)) return true; |
|
| 30 | + } |
|
| 27 | 31 | |
| 28 | 32 | # ------------------------ |
| 29 | 33 | |
@@ -40,9 +44,13 @@ discard block |
||
| 40 | 44 | |
| 41 | 45 | $file_robots = (DIR_DATA . 'Agent/Robots.php'); |
| 42 | 46 | |
| 43 | - if (is_array($mobiles = Explorer::include($file_mobiles))) self::$mobiles = $mobiles; |
|
| 47 | + if (is_array($mobiles = Explorer::include($file_mobiles))) { |
|
| 48 | + self::$mobiles = $mobiles; |
|
| 49 | + } |
|
| 44 | 50 | |
| 45 | - if (is_array($robots = Explorer::include($file_robots))) self::$robots = $robots; |
|
| 51 | + if (is_array($robots = Explorer::include($file_robots))) { |
|
| 52 | + self::$robots = $robots; |
|
| 53 | + } |
|
| 46 | 54 | } |
| 47 | 55 | |
| 48 | 56 | /** |
@@ -22,7 +22,12 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $value = null; |
| 24 | 24 | |
| 25 | - foreach ($path as $item) if (isset($array[$item])) $value = ($array = $array[$item]); else return null; |
|
| 25 | + foreach ($path as $item) { |
|
| 26 | + if (isset($array[$item])) $value = ($array = $array[$item]); |
|
| 27 | + } |
|
| 28 | + else { |
|
| 29 | + return null; |
|
| 30 | + } |
|
| 26 | 31 | |
| 27 | 32 | # ------------------------ |
| 28 | 33 | |
@@ -38,7 +43,9 @@ discard block |
||
| 38 | 43 | |
| 39 | 44 | $selected = array_intersect_key($array, array_flip($keys)); |
| 40 | 45 | |
| 41 | - if (null !== $filter) $selected = array_filter($array, $filter); |
|
| 46 | + if (null !== $filter) { |
|
| 47 | + $selected = array_filter($array, $filter); |
|
| 48 | + } |
|
| 42 | 49 | |
| 43 | 50 | # ------------------------ |
| 44 | 51 | |
@@ -54,7 +61,9 @@ discard block |
||
| 54 | 61 | |
| 55 | 62 | $indexed = []; |
| 56 | 63 | |
| 57 | - foreach ($array as $key => $value) $indexed[] = [$key_name => $key, $value_name => $value]; |
|
| 64 | + foreach ($array as $key => $value) { |
|
| 65 | + $indexed[] = [$key_name => $key, $value_name => $value]; |
|
| 66 | + } |
|
| 58 | 67 | |
| 59 | 68 | # ------------------------ |
| 60 | 69 | |
@@ -71,9 +80,15 @@ discard block |
||
| 71 | 80 | |
| 72 | 81 | $sorted = []; $column = array_map($select_key, $array); |
| 73 | 82 | |
| 74 | - if (!$descending) asort($column); else arsort($column); |
|
| 83 | + if (!$descending) { |
|
| 84 | + asort($column); |
|
| 85 | + } else { |
|
| 86 | + arsort($column); |
|
| 87 | + } |
|
| 75 | 88 | |
| 76 | - foreach (array_keys($column) as $key) $sorted[$key] = $array[$key]; |
|
| 89 | + foreach (array_keys($column) as $key) { |
|
| 90 | + $sorted[$key] = $array[$key]; |
|
| 91 | + } |
|
| 77 | 92 | |
| 78 | 93 | # ------------------------ |
| 79 | 94 | |
@@ -19,9 +19,13 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public static function validate(string $date, string $format) { |
| 21 | 21 | |
| 22 | - if (false === ($datetime = date_create_from_format($format, $date))) return false; |
|
| 22 | + if (false === ($datetime = date_create_from_format($format, $date))) { |
|
| 23 | + return false; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | - if (false === ($formatted = $datetime->format($format))) return false; |
|
| 26 | + if (false === ($formatted = $datetime->format($format))) { |
|
| 27 | + return false; |
|
| 28 | + } |
|
| 25 | 29 | |
| 26 | 30 | # ------------------------ |
| 27 | 31 | |
@@ -58,7 +62,9 @@ discard block |
||
| 58 | 62 | |
| 59 | 63 | public static function validateYear(int $year) { |
| 60 | 64 | |
| 61 | - if (false === ($year = self::validate($year, 'Y'))) return false; |
|
| 65 | + if (false === ($year = self::validate($year, 'Y'))) { |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 62 | 68 | |
| 63 | 69 | return (($year > '1900') ? (($year > self::getYear()) ? self::getYear() : $year) : '1900'); |
| 64 | 70 | } |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function set(string $name, $value) { |
| 23 | 23 | |
| 24 | - if (!in_array($name, ['error', 'status'], true)) $this->data[$name] = $value; |
|
| 24 | + if (!in_array($name, ['error', 'status'], true)) { |
|
| 25 | + $this->data[$name] = $value; |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | 28 | return $this; |
| 27 | 29 | } |
@@ -82,7 +84,9 @@ discard block |
||
| 82 | 84 | |
| 83 | 85 | $data = ['status' => $this->status]; |
| 84 | 86 | |
| 85 | - if (null !== $this->error) $data['error'] = $this->error; |
|
| 87 | + if (null !== $this->error) { |
|
| 88 | + $data['error'] = $this->error; |
|
| 89 | + } |
|
| 86 | 90 | |
| 87 | 91 | # ------------------------ |
| 88 | 92 | |
@@ -73,25 +73,25 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $pattern = [ |
| 75 | 75 | |
| 76 | - 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', |
|
| 77 | - 'Д' => 'D', 'Е' => 'E', 'Ж' => 'ZH', 'З' => 'Z', |
|
| 78 | - 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', |
|
| 79 | - 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', |
|
| 80 | - 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', |
|
| 81 | - 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'CH', |
|
| 82 | - 'Ш' => 'SH', 'Щ' => 'SCH', 'Ъ' => '', 'Ь' => '', |
|
| 83 | - 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'JU', 'Я' => 'JA', |
|
| 84 | - 'І' => 'I', 'Ї' => 'JI', 'Ё' => 'JO', |
|
| 85 | - |
|
| 86 | - 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', |
|
| 87 | - 'д' => 'd', 'е' => 'e', 'ж' => 'zh', 'з' => 'z', |
|
| 88 | - 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', |
|
| 89 | - 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', |
|
| 90 | - 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', |
|
| 91 | - 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', |
|
| 92 | - 'ш' => 'sh', 'щ' => 'sch', 'ъ' => '', 'ь' => '', |
|
| 93 | - 'ы' => 'y', 'э' => 'e', 'ю' => 'ju', 'я' => 'ja', |
|
| 94 | - 'і' => 'i', 'ї' => 'ji', 'ё' => 'jo' |
|
| 76 | + 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', |
|
| 77 | + 'Д' => 'D', 'Е' => 'E', 'Ж' => 'ZH', 'З' => 'Z', |
|
| 78 | + 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', |
|
| 79 | + 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', |
|
| 80 | + 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', |
|
| 81 | + 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'CH', |
|
| 82 | + 'Ш' => 'SH', 'Щ' => 'SCH', 'Ъ' => '', 'Ь' => '', |
|
| 83 | + 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'JU', 'Я' => 'JA', |
|
| 84 | + 'І' => 'I', 'Ї' => 'JI', 'Ё' => 'JO', |
|
| 85 | + |
|
| 86 | + 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', |
|
| 87 | + 'д' => 'd', 'е' => 'e', 'ж' => 'zh', 'з' => 'z', |
|
| 88 | + 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', |
|
| 89 | + 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', |
|
| 90 | + 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', |
|
| 91 | + 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', |
|
| 92 | + 'ш' => 'sh', 'щ' => 'sch', 'ъ' => '', 'ь' => '', |
|
| 93 | + 'ы' => 'y', 'э' => 'e', 'ю' => 'ju', 'я' => 'ja', |
|
| 94 | + 'і' => 'i', 'ї' => 'ji', 'ё' => 'jo' |
|
| 95 | 95 | ]; |
| 96 | 96 | |
| 97 | 97 | # ------------------------ |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if (($maxlength < 1) || (self::length($string = trim($string)) <= $maxlength)) return $string; |
| 178 | 178 | |
| 179 | - $string = (rtrim(self::substr($string, 0, $maxlength)) . ($ellipsis ? '...' : '')); |
|
| 179 | + $string = (rtrim(self::substr($string, 0, $maxlength)).($ellipsis ? '...' : '')); |
|
| 180 | 180 | |
| 181 | 181 | # ------------------------ |
| 182 | 182 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | public static function encode(string $salt, string $string) { |
| 206 | 206 | |
| 207 | - return sha1($salt . substr(sha1($string), 8, 32)); |
|
| 207 | + return sha1($salt.substr(sha1($string), 8, 32)); |
|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -19,18 +19,24 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function __construct(string $url = '') { |
| 21 | 21 | |
| 22 | - if (false === ($url = parse_url($url))) return; |
|
| 22 | + if (false === ($url = parse_url($url))) { |
|
| 23 | + return; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | # Parse path |
| 25 | 27 | |
| 26 | - if (isset($url['path'])) foreach (explode('/', $url['path']) as $part) { |
|
| 28 | + if (isset($url['path'])) { |
|
| 29 | + foreach (explode('/', $url['path']) as $part) { |
|
| 27 | 30 | |
| 28 | 31 | if ('' !== $part) $this->path[] = urldecode($part); |
| 29 | 32 | } |
| 33 | + } |
|
| 30 | 34 | |
| 31 | 35 | # Parse query |
| 32 | 36 | |
| 33 | - if (isset($url['query'])) parse_str($url['query'], $this->query); |
|
| 37 | + if (isset($url['query'])) { |
|
| 38 | + parse_str($url['query'], $this->query); |
|
| 39 | + } |
|
| 34 | 40 | } |
| 35 | 41 | |
| 36 | 42 | /** |
@@ -47,10 +47,10 @@ |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Get a query attribute |
|
| 51 | - * |
|
| 52 | - * @return the value or false if the attribute does not exist |
|
| 53 | - */ |
|
| 50 | + * Get a query attribute |
|
| 51 | + * |
|
| 52 | + * @return the value or false if the attribute does not exist |
|
| 53 | + */ |
|
| 54 | 54 | |
| 55 | 55 | public function getAttribute(string $name) { |
| 56 | 56 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public function getPath() : string { |
| 74 | 74 | |
| 75 | - return ('/' . implode('/', array_map('urlencode', $this->path))); |
|
| 75 | + return ('/'.implode('/', array_map('urlencode', $this->path))); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function getQuery() : string { |
| 83 | 83 | |
| 84 | - return (($query = http_build_query($this->query)) ? ('?' . $query) : ''); |
|
| 84 | + return (($query = http_build_query($this->query)) ? ('?'.$query) : ''); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function getString(bool $include_query = true) : string { |
| 110 | 110 | |
| 111 | - return ($this->getPath() . ($include_query ? $this->getQuery() : '')); |
|
| 111 | + return ($this->getPath().($include_query ? $this->getQuery() : '')); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | |
| 182 | 182 | foreach ($this->fields as $field) { |
| 183 | 183 | |
| 184 | - $block->setBlock(('field_' . $field->getName()), $field->getBlock()); |
|
| 184 | + $block->setBlock(('field_'.$field->getName()), $field->getBlock()); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private function addField(Form\Field $field) { |
| 25 | 25 | |
| 26 | - if ($this->posted || ('' === ($key = $field->getKey()))) return false; |
|
| 26 | + if ($this->posted || ('' === ($key = $field->getKey()))) { |
|
| 27 | + return false; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | $this->fields[$key] = $field; |
| 29 | 31 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | |
| 39 | 41 | public function __construct(string $name = '') { |
| 40 | 42 | |
| 41 | - if (preg_match(REGEX_FORM_NAME, $name)) $this->name = $name; |
|
| 43 | + if (preg_match(REGEX_FORM_NAME, $name)) { |
|
| 44 | + $this->name = $name; |
|
| 45 | + } |
|
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | /** |
@@ -90,9 +94,15 @@ discard block |
||
| 90 | 94 | |
| 91 | 95 | foreach ($this->fields as $field) { |
| 92 | 96 | |
| 93 | - if (($field instanceof Form\Field\Checkbox) || $field->disabled) continue; |
|
| 97 | + if (($field instanceof Form\Field\Checkbox) || $field->disabled) { |
|
| 98 | + continue; |
|
| 99 | + } |
|
| 94 | 100 | |
| 95 | - if (false !== Request::post($field->getName())) $check = true; else return false; |
|
| 101 | + if (false !== Request::post($field->getName())) { |
|
| 102 | + $check = true; |
|
| 103 | + } else { |
|
| 104 | + return false; |
|
| 105 | + } |
|
| 96 | 106 | } |
| 97 | 107 | |
| 98 | 108 | # ------------------------ |
@@ -108,7 +118,9 @@ discard block |
||
| 108 | 118 | |
| 109 | 119 | public function post() { |
| 110 | 120 | |
| 111 | - if ($this->posted || !$this->check()) return false; |
|
| 121 | + if ($this->posted || !$this->check()) { |
|
| 122 | + return false; |
|
| 123 | + } |
|
| 112 | 124 | |
| 113 | 125 | $post = []; $errors = false; |
| 114 | 126 | |
@@ -116,7 +128,9 @@ discard block |
||
| 116 | 128 | |
| 117 | 129 | $field->post(); $post[$field->getKey()] = $field->getValue(); |
| 118 | 130 | |
| 119 | - if ($field->error) $errors = true; |
|
| 131 | + if ($field->error) { |
|
| 132 | + $errors = true; |
|
| 133 | + } |
|
| 120 | 134 | } |
| 121 | 135 | |
| 122 | 136 | $this->posted = true; $this->errors = $errors; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Add a field to the form |
| 20 | 20 | * |
| 21 | - * @return true if the field was successfully added, otherwise false |
|
| 21 | + * @return boolean if the field was successfully added, otherwise false |
|
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | private function addField(Form\Field $field) : bool { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * Add a text field |
| 46 | 46 | * |
| 47 | - * @return true if the field was successfully added, otherwise false |
|
| 47 | + * @return boolean if the field was successfully added, otherwise false |
|
| 48 | 48 | */ |
| 49 | 49 | |
| 50 | 50 | public function addText(string $key, string $value = '', |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Add a select field |
| 59 | 59 | * |
| 60 | - * @return true if the field was successfully added, otherwise false |
|
| 60 | + * @return boolean if the field was successfully added, otherwise false |
|
| 61 | 61 | */ |
| 62 | 62 | |
| 63 | 63 | public function addSelect(string $key, string $value = '', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | /** |
| 71 | 71 | * Add a checkbox field |
| 72 | 72 | * |
| 73 | - * @return true if the field was successfully added, otherwise false |
|
| 73 | + * @return boolean if the field was successfully added, otherwise false |
|
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | 76 | public function addCheckbox(string $key, string $value = '') : bool { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * Check if valid POST data has been recieved |
| 83 | 83 | * |
| 84 | - * @return true if the data has been recieved, otherwise false |
|
| 84 | + * @return boolean if the data has been recieved, otherwise false |
|
| 85 | 85 | */ |
| 86 | 86 | |
| 87 | 87 | public function check() : bool { |
@@ -53,7 +53,9 @@ |
||
| 53 | 53 | |
| 54 | 54 | $tag->setAttribute('type', 'checkbox'); |
| 55 | 55 | |
| 56 | - if ($this->value) $tag->setAttribute('checked', 'checked'); |
|
| 56 | + if ($this->value) { |
|
| 57 | + $tag->setAttribute('checked', 'checked'); |
|
| 58 | + } |
|
| 57 | 59 | |
| 58 | 60 | # ------------------------ |
| 59 | 61 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | if (($name === '.') || ($name === '..')) continue; |
| 25 | 25 | |
| 26 | - if (@$checker($dir_name . $name)) yield $name; |
|
| 26 | + if (@$checker($dir_name.$name)) yield $name; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | closedir($handler); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | foreach (array_diff($list, ['.', '..']) as $name) { |
| 95 | 95 | |
| 96 | - $name = ($dir_name . '/' . $name); |
|
| 96 | + $name = ($dir_name.'/'.$name); |
|
| 97 | 97 | |
| 98 | 98 | if (@is_dir($name)) self::removeDir($name, true); |
| 99 | 99 | |
@@ -21,9 +21,13 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | while (false !== ($name = readdir($handler))) { |
| 23 | 23 | |
| 24 | - if (($name === '.') || ($name === '..')) continue; |
|
| 24 | + if (($name === '.') || ($name === '..')) { |
|
| 25 | + continue; |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | - if (@$checker($dir_name . $name)) yield $name; |
|
| 28 | + if (@$checker($dir_name . $name)) { |
|
| 29 | + yield $name; |
|
| 30 | + } |
|
| 27 | 31 | } |
| 28 | 32 | |
| 29 | 33 | closedir($handler); |
@@ -36,7 +40,9 @@ discard block |
||
| 36 | 40 | |
| 37 | 41 | private static function getInfo(string $file_name, int $param, bool $check_exists = true) { |
| 38 | 42 | |
| 39 | - if ($check_exists && !self::isFile($file_name)) return false; |
|
| 43 | + if ($check_exists && !self::isFile($file_name)) { |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 40 | 46 | |
| 41 | 47 | return pathinfo($file_name, $param); |
| 42 | 48 | } |
@@ -95,9 +101,11 @@ discard block |
||
| 95 | 101 | |
| 96 | 102 | $name = ($dir_name . '/' . $name); |
| 97 | 103 | |
| 98 | - if (@is_dir($name)) self::removeDir($name, true); |
|
| 99 | - |
|
| 100 | - else if (@is_file($name)) self::removeFile($name); |
|
| 104 | + if (@is_dir($name)) { |
|
| 105 | + self::removeDir($name, true); |
|
| 106 | + } else if (@is_file($name)) { |
|
| 107 | + self::removeFile($name); |
|
| 108 | + } |
|
| 101 | 109 | } |
| 102 | 110 | } |
| 103 | 111 | |
@@ -123,7 +131,9 @@ discard block |
||
| 123 | 131 | |
| 124 | 132 | public static function iterateDirs(string $dir_name) { |
| 125 | 133 | |
| 126 | - foreach (self::getList($dir_name, 'is_dir') as $name) yield $name; |
|
| 134 | + foreach (self::getList($dir_name, 'is_dir') as $name) { |
|
| 135 | + yield $name; |
|
| 136 | + } |
|
| 127 | 137 | } |
| 128 | 138 | |
| 129 | 139 | /** |
@@ -132,7 +142,9 @@ discard block |
||
| 132 | 142 | |
| 133 | 143 | public static function iterateFiles(string $dir_name) { |
| 134 | 144 | |
| 135 | - foreach (self::getList($dir_name, 'is_file') as $name) yield $name; |
|
| 145 | + foreach (self::getList($dir_name, 'is_file') as $name) { |
|
| 146 | + yield $name; |
|
| 147 | + } |
|
| 136 | 148 | } |
| 137 | 149 | |
| 138 | 150 | /** |
@@ -238,7 +250,9 @@ discard block |
||
| 238 | 250 | |
| 239 | 251 | public static function include(string $file_name) { |
| 240 | 252 | |
| 241 | - if ((strtolower(self::getExtension($file_name)) !== 'php')) return false; |
|
| 253 | + if ((strtolower(self::getExtension($file_name)) !== 'php')) { |
|
| 254 | + return false; |
|
| 255 | + } |
|
| 242 | 256 | |
| 243 | 257 | return @include $file_name; |
| 244 | 258 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * Create a directory |
| 66 | 66 | * |
| 67 | - * @return true on success or false on failure |
|
| 67 | + * @return boolean on success or false on failure |
|
| 68 | 68 | */ |
| 69 | 69 | |
| 70 | 70 | public static function createDir(string $dir_name, int $mode = 0755) : bool { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * Create a file |
| 77 | 77 | * |
| 78 | - * @return true on success or false on failure |
|
| 78 | + * @return boolean on success or false on failure |
|
| 79 | 79 | */ |
| 80 | 80 | |
| 81 | 81 | public static function createFile(string $file_name) : bool { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * Remove a directory |
| 88 | 88 | * |
| 89 | - * @return true on success or false on failure |
|
| 89 | + * @return boolean on success or false on failure |
|
| 90 | 90 | */ |
| 91 | 91 | |
| 92 | 92 | public static function removeDir(string $dir_name, bool $recursive = false) : bool { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * Remove a file |
| 113 | 113 | * |
| 114 | - * @return true on success or false on failure |
|
| 114 | + * @return boolean on success or false on failure |
|
| 115 | 115 | */ |
| 116 | 116 | |
| 117 | 117 | public static function removeFile(string $file_name) : bool { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * Get an extnesion of a file |
| 193 | 193 | * |
| 194 | - * @return the string or false if check_exists is true and the file does not actually exists |
|
| 194 | + * @return string string or false if check_exists is true and the file does not actually exists |
|
| 195 | 195 | */ |
| 196 | 196 | |
| 197 | 197 | public static function getExtension(string $file_name, bool $check_exists = true) { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | /** |
| 214 | 214 | * Get file contents |
| 215 | 215 | * |
| 216 | - * @return the read data or false on failure |
|
| 216 | + * @return string read data or false on failure |
|
| 217 | 217 | */ |
| 218 | 218 | |
| 219 | 219 | public static function getContents(string $file_name) { |