Minor fix

This commit is contained in:
Visman 2019-12-29 16:52:39 +07:00
parent df7c1c4905
commit 54d1e7d537
13 changed files with 14 additions and 26 deletions

View file

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

View file

@ -204,12 +204,7 @@ class Files
{
$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';
return false;
}

View file

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

View file

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

View file

@ -37,7 +37,7 @@ class Manager extends ManagerModel
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');
}
@ -105,7 +105,7 @@ class Manager extends ManagerModel
foreach ($root->subforums as $forum) {
if ($forum->cat_id === $cid) {
$del = array_merge($del, [$forum], $forum->descendants);
$del = \array_merge($del, [$forum], $forum->descendants);
}
}

View file

@ -19,7 +19,7 @@ class Save extends Method
$words = $this->model->load();
$forDel = [];
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;
}
if ('' === \trim($list[$id]['search_for'])) {

View file

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

View file

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

View file

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

View file

@ -14,10 +14,7 @@ class Model extends ParentModel
public function init()
{
$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'];
} else {
$this->load();

View file

@ -59,7 +59,7 @@ class Current extends Action
# $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
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); //????
}

View file

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

View file

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