Visman преди 5 години
родител
ревизия
54d1e7d537

+ 1 - 3
app/Core/Cache/FileCache.php

@@ -50,9 +50,7 @@ class FileCache implements ProviderCacheInterface
         if (\is_file($file)) {
         if (\is_file($file)) {
             require $file;
             require $file;
 
 
-            if (isset($expire) && isset($data)
-                && ($expire < 1 || $expire > \time())
-            ) {
+            if (isset($expire, $data) && ($expire < 1 || $expire > \time())) {
                 return $data;
                 return $data;
             }
             }
         }
         }

+ 1 - 6
app/Core/Files.php

@@ -204,12 +204,7 @@ class Files
     {
     {
         $this->error = null;
         $this->error = null;
 
 
-        if (! isset($file['tmp_name'])
-            || ! isset($file['name'])
-            || ! isset($file['type'])
-            || ! isset($file['error'])
-            || ! isset($file['size'])
-        ) {
+        if (! isset($file['tmp_name'], $file['name'], $file['type'], $file['error'], $file['size'])) {
             $this->error = 'Expected file description array';
             $this->error = 'Expected file description array';
             return false;
             return false;
         }
         }

+ 1 - 1
app/Core/Router.php

@@ -232,7 +232,7 @@ class Router
     }
     }
 
 
     /**
     /**
-     * Метод добавдяет маршрут
+     * Метод добавляет маршрут
      *
      *
      * @param string|array $method
      * @param string|array $method
      * @param string $route
      * @param string $route

+ 2 - 3
app/Core/Validator.php

@@ -351,7 +351,7 @@ class Validator
     /**
     /**
      * Добавляет ошибку
      * Добавляет ошибку
      *
      *
-     * @param mixed $error
+     * @param string|bool $error
      * @param string $type
      * @param string $type
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
@@ -380,8 +380,7 @@ class Validator
             $error = $this->messages[$field];
             $error = $this->messages[$field];
         }
         }
         if (\is_array($error)) {
         if (\is_array($error)) {
-            $type = $error[0];
-            $error = $error[1];
+            list($type, $error) = $error;
         }
         }
 
 
         $this->errors[$type][] = \ForkBB\__($error, [':alias' => \ForkBB\__($alias), ':attr' => $attr]);
         $this->errors[$type][] = \ForkBB\__($error, [':alias' => \ForkBB\__($alias), ':attr' => $attr]);

+ 2 - 2
app/Models/Categories/Manager.php

@@ -37,7 +37,7 @@ class Manager extends ManagerModel
 
 
     public function set($key, $value)
     public function set($key, $value)
     {
     {
-        if (! isset($value['cat_name']) || ! isset($value['disp_position'])) {
+        if (! isset($value['cat_name'], $value['disp_position'])) {
             throw new InvalidArgumentException('Expected array with cat_name and disp_position elements');
             throw new InvalidArgumentException('Expected array with cat_name and disp_position elements');
         }
         }
 
 
@@ -105,7 +105,7 @@ class Manager extends ManagerModel
 
 
         foreach ($root->subforums as $forum) {
         foreach ($root->subforums as $forum) {
             if ($forum->cat_id === $cid) {
             if ($forum->cat_id === $cid) {
-                $del = array_merge($del, [$forum], $forum->descendants);
+                $del = \array_merge($del, [$forum], $forum->descendants);
             }
             }
         }
         }
 
 

+ 1 - 1
app/Models/Censorship/Save.php

@@ -19,7 +19,7 @@ class Save extends Method
         $words  = $this->model->load();
         $words  = $this->model->load();
         $forDel = [];
         $forDel = [];
         foreach ($list as $id => $row) {
         foreach ($list as $id => $row) {
-            if (! isset($list[$id]['search_for']) || ! isset($list[$id]['replace_with'])) {
+            if (! isset($list[$id]['search_for'], $list[$id]['replace_with'])) {
                 continue;
                 continue;
             }
             }
             if ('' === \trim($list[$id]['search_for'])) {
             if ('' === \trim($list[$id]['search_for'])) {

+ 1 - 1
app/Models/Forum/Manager.php

@@ -44,7 +44,7 @@ class Manager extends ManagerModel
 
 
         $mark = $this->c->Cache->get('forums_mark');
         $mark = $this->c->Cache->get('forums_mark');
         if (empty($mark)) {
         if (empty($mark)) {
-            $this->c->Cache->set('forums_mark', time());
+            $this->c->Cache->set('forums_mark', \time());
             $list = $this->refresh($group);
             $list = $this->refresh($group);
         } else {
         } else {
             $result = $this->c->Cache->get('forums_' . $gid);
             $result = $this->c->Cache->get('forums_' . $gid);

+ 0 - 1
app/Models/Forum/Model.php

@@ -368,5 +368,4 @@ class Model extends DataModel
 
 
         return $data;
         return $data;
     }
     }
-
 }
 }

+ 1 - 1
app/Models/Search/Model.php

@@ -117,7 +117,7 @@ class Model extends ParentModel
             return $indexing ? null : $word;
             return $indexing ? null : $word;
         }
         }
 
 
-        $len = \mb_strlen(trim($word, '?*'), 'UTF-8');
+        $len = \mb_strlen(\trim($word, '?*'), 'UTF-8');
 
 
         if ($len < 3) {
         if ($len < 3) {
             return null;
             return null;

+ 1 - 4
app/Models/Stopwords/Model.php

@@ -14,10 +14,7 @@ class Model extends ParentModel
     public function init()
     public function init()
     {
     {
         $data = $this->c->Cache->get('stopwords');
         $data = $this->c->Cache->get('stopwords');
-        if (isset($data['id'])
-            && isset($data['stopwords'])
-            && $data['id'] === $this->generateId()
-        ) {
+        if (isset($data['id'], $data['stopwords']) && $data['id'] === $this->generateId()) {
             $this->list = $data['stopwords'];
             $this->list = $data['stopwords'];
         } else {
         } else {
             $this->load();
             $this->load();

+ 1 - 1
app/Models/User/Current.php

@@ -59,7 +59,7 @@ class Current extends Action
 #                $user->__disp_posts = $this->c->config->o_disp_posts_default;
 #                $user->__disp_posts = $this->c->config->o_disp_posts_default;
 #            }
 #            }
             // Special case: We've timed out, but no other user has browsed the forums since we timed out
             // Special case: We've timed out, but no other user has browsed the forums since we timed out
-            if ($user->isLogged && $user->logged < time() - $this->c->config->o_timeout_visit) {
+            if ($user->isLogged && $user->logged < \time() - $this->c->config->o_timeout_visit) {
                 $this->manager->updateLastVisit($user); //????
                 $this->manager->updateLastVisit($user); //????
             }
             }
 
 

+ 1 - 1
app/Models/User/UpdateCountPosts.php

@@ -21,7 +21,7 @@ class UpdateCountPosts extends Action
         foreach ($args as $arg) {
         foreach ($args as $arg) {
             if ($arg instanceof User) {
             if ($arg instanceof User) {
                 $ids[$arg->id] = true;
                 $ids[$arg->id] = true;
-            } elseif (is_int($arg) && $arg > 0) {
+            } elseif (\is_int($arg) && $arg > 0) {
                 $ids[$arg] = true;
                 $ids[$arg] = true;
             } else {
             } else {
                 throw new InvalidArgumentException('Expected user or positive integer id');
                 throw new InvalidArgumentException('Expected user or positive integer id');

+ 1 - 1
app/Models/User/UpdateCountTopics.php

@@ -21,7 +21,7 @@ class UpdateCountTopics extends Action
         foreach ($args as $arg) {
         foreach ($args as $arg) {
             if ($arg instanceof User) {
             if ($arg instanceof User) {
                 $ids[$arg->id] = true;
                 $ids[$arg->id] = true;
-            } elseif (is_int($arg) && $arg > 0) {
+            } elseif (\is_int($arg) && $arg > 0) {
                 $ids[$arg] = true;
                 $ids[$arg] = true;
             } else {
             } else {
                 throw new InvalidArgumentException('Expected user or positive integer id');
                 throw new InvalidArgumentException('Expected user or positive integer id');