ソースを参照

Fix case insensitivity of method_exists() function

For BBCodeList\Structure
Visman 2 年 前
コミット
fd5dda5aef

+ 15 - 15
app/Models/BBCodeList/Structure.php

@@ -61,14 +61,14 @@ class Structure extends Model
 
 
         foreach ($bbcode as $cur) {
         foreach ($bbcode as $cur) {
             if ($this->tag === $cur['tag']) {
             if ($this->tag === $cur['tag']) {
-                return $this->setAttrs($cur);
+                return $this->setModelAttrs($cur);
             }
             }
         }
         }
     }
     }
 
 
     public function fromString(string $data): Structure
     public function fromString(string $data): Structure
     {
     {
-        return $this->setAttrs(\json_decode($data, true, 512, \JSON_THROW_ON_ERROR));
+        return $this->setModelAttrs(\json_decode($data, true, 512, \JSON_THROW_ON_ERROR));
     }
     }
 
 
     public function toString(): string
     public function toString(): string
@@ -142,14 +142,14 @@ class Structure extends Model
 
 
     protected function gettype(): string
     protected function gettype(): string
     {
     {
-        $type = $this->getAttr('type');
+        $type = $this->getModelAttr('type');
 
 
         return \is_string($type) ? $type : 'inline';
         return \is_string($type) ? $type : 'inline';
     }
     }
 
 
     protected function getparents(): array
     protected function getparents(): array
     {
     {
-        $parents = $this->getAttr('parents');
+        $parents = $this->getModelAttr('parents');
 
 
         if (\is_array($parents)) {
         if (\is_array($parents)) {
             return $parents;
             return $parents;
@@ -163,36 +163,36 @@ class Structure extends Model
     protected function setrecursive($value): void
     protected function setrecursive($value): void
     {
     {
         $value = empty($value) ? null : true;
         $value = empty($value) ? null : true;
-        $this->setAttr('recursive', $value);
+        $this->setModelAttr('recursive', $value);
     }
     }
 
 
     protected function settext_only($value): void
     protected function settext_only($value): void
     {
     {
         $value = empty($value) ? null : true;
         $value = empty($value) ? null : true;
-        $this->setAttr('text_only', $value);
+        $this->setModelAttr('text_only', $value);
     }
     }
 
 
     protected function settags_only($value): void
     protected function settags_only($value): void
     {
     {
         $value = empty($value) ? null : true;
         $value = empty($value) ? null : true;
-        $this->setAttr('tags_only', $value);
+        $this->setModelAttr('tags_only', $value);
     }
     }
 
 
     protected function setpre($value): void
     protected function setpre($value): void
     {
     {
         $value = empty($value) ? null : true;
         $value = empty($value) ? null : true;
-        $this->setAttr('pre', $value);
+        $this->setModelAttr('pre', $value);
     }
     }
 
 
     protected function setsingle($value): void
     protected function setsingle($value): void
     {
     {
         $value = empty($value) ? null : true;
         $value = empty($value) ? null : true;
-        $this->setAttr('single', $value);
+        $this->setModelAttr('single', $value);
     }
     }
 
 
     protected function getauto(): bool
     protected function getauto(): bool
     {
     {
-        $auto = $this->getAttr('auto');
+        $auto = $this->getModelAttr('auto');
 
 
         if (\is_bool($auto)) {
         if (\is_bool($auto)) {
             return $auto;
             return $auto;
@@ -206,13 +206,13 @@ class Structure extends Model
     protected function setauto($value): void
     protected function setauto($value): void
     {
     {
         $value = ! empty($value);
         $value = ! empty($value);
-        $this->setAttr('auto', $value);
+        $this->setModelAttr('auto', $value);
     }
     }
 
 
     protected function setself_nesting($value): void
     protected function setself_nesting($value): void
     {
     {
         $value = (int) $value < 1 ? false : (int) $value;
         $value = (int) $value < 1 ? false : (int) $value;
-        $this->setAttr('self_nesting', $value);
+        $this->setModelAttr('self_nesting', $value);
     }
     }
 
 
     protected function getBBAttr(string $name, array $fields): mixed
     protected function getBBAttr(string $name, array $fields): mixed
@@ -255,7 +255,7 @@ class Structure extends Model
 
 
     protected function setBBAttr(string $name, mixed $data, array $fields): void
     protected function setBBAttr(string $name, mixed $data, array $fields): void
     {
     {
-        $attrs = $this->getAttr('attrs');
+        $attrs = $this->getModelAttr('attrs');
 
 
         if (
         if (
             empty($data['allowed'])
             empty($data['allowed'])
@@ -289,7 +289,7 @@ class Structure extends Model
             $attrs[$name] = empty($result) ? true : $result;
             $attrs[$name] = empty($result) ? true : $result;
         }
         }
 
 
-        $this->setAttr('attrs', $attrs);
+        $this->setModelAttr('attrs', $attrs);
     }
     }
 
 
     protected function getno_attr(): mixed
     protected function getno_attr(): mixed
@@ -314,7 +314,7 @@ class Structure extends Model
 
 
     protected function getother_attrs(): array
     protected function getother_attrs(): array
     {
     {
-        $attrs = $this->getAttr('attrs');
+        $attrs = $this->getModelAttr('attrs');
 
 
         if (! \is_array($attrs)) {
         if (! \is_array($attrs)) {
             return [];
             return [];

+ 1 - 1
app/Models/Config/Config.php

@@ -38,7 +38,7 @@ class Config extends DataModel
             }
             }
         }
         }
 
 
-        $this->setAttrs($config);
+        $this->setModelAttrs($config);
 
 
         return $this;
         return $this;
     }
     }

+ 1 - 1
app/Models/Config/Install.php

@@ -20,7 +20,7 @@ class Install extends Method
      */
      */
     public function install(): Config
     public function install(): Config
     {
     {
-        $this->model->setAttrs($this->c->forConfig);
+        $this->model->setModelAttrs($this->c->forConfig);
 
 
         return $this->model;
         return $this->model;
     }
     }

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

@@ -27,7 +27,7 @@ class Save extends Method
             return $this->model;
             return $this->model;
         }
         }
 
 
-        $values = $this->model->getAttrs();
+        $values = $this->model->getModelAttrs();
 
 
         foreach ($modified as $name) {
         foreach ($modified as $name) {
             if (\array_key_exists($name, $values)) {
             if (\array_key_exists($name, $values)) {

+ 1 - 1
app/Models/Cookie/Cookie.php

@@ -42,7 +42,7 @@ class Cookie extends Model
             'time'     => 31536000,
             'time'     => 31536000,
         ];
         ];
 
 
-        $this->setAttrs($options);
+        $this->setModelAttrs($options);
         $this->init();
         $this->init();
         $this->noSet = true;
         $this->noSet = true;
     }
     }

+ 1 - 1
app/Models/DBMap/DBMap.php

@@ -37,7 +37,7 @@ class DBMap extends Model
             }
             }
         }
         }
 
 
-        $this->setAttrs($map);
+        $this->setModelAttrs($map);
 
 
         return $this;
         return $this;
     }
     }

+ 3 - 3
app/Models/DataModel.php

@@ -29,12 +29,12 @@ class DataModel extends Model
      * Сбрасывает вычисленные свойства
      * Сбрасывает вычисленные свойства
      * Флаги модификации свойст сброшены
      * Флаги модификации свойст сброшены
      */
      */
-    public function setAttrs(array $attrs): Model
+    public function setModelAttrs(array $attrs): Model
     {
     {
         $this->zModFlags   = [];
         $this->zModFlags   = [];
         $this->zTrackFlags = [];
         $this->zTrackFlags = [];
 
 
-        return parent::setAttrs($attrs);
+        return parent::setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**
@@ -142,7 +142,7 @@ class DataModel extends Model
     {
     {
         // без вычисления
         // без вычисления
         if (\str_starts_with($name, '__')) {
         if (\str_starts_with($name, '__')) {
-            return $this->getAttr(\substr($name, 2));
+            return $this->getModelAttr(\substr($name, 2));
         // с вычислениями
         // с вычислениями
         } else {
         } else {
             return parent::__get($name);
             return parent::__get($name);

+ 9 - 9
app/Models/Forum/Forum.php

@@ -89,7 +89,7 @@ class Forum extends DataModel
     protected function getsubforums(): array
     protected function getsubforums(): array
     {
     {
         $sub  = [];
         $sub  = [];
-        $attr = $this->getAttr('subforums');
+        $attr = $this->getModelAttr('subforums');
 
 
         if (\is_array($attr)) {
         if (\is_array($attr)) {
             foreach ($attr as $id) {
             foreach ($attr as $id) {
@@ -106,7 +106,7 @@ class Forum extends DataModel
     protected function getdescendants(): array
     protected function getdescendants(): array
     {
     {
         $all  = [];
         $all  = [];
-        $attr = $this->getAttr('descendants');
+        $attr = $this->getModelAttr('descendants');
 
 
         if (\is_array($attr)) {
         if (\is_array($attr)) {
             foreach ($attr as $id) {
             foreach ($attr as $id) {
@@ -242,7 +242,7 @@ class Forum extends DataModel
      */
      */
     protected function getmoderators(): array
     protected function getmoderators(): array
     {
     {
-        $attr = $this->getAttr('moderators');
+        $attr = $this->getModelAttr('moderators');
 
 
         if (
         if (
             empty($attr)
             empty($attr)
@@ -278,7 +278,7 @@ class Forum extends DataModel
      */
      */
     public function modAdd(User ...$users): void
     public function modAdd(User ...$users): void
     {
     {
-        $attr = $this->getAttr('moderators');
+        $attr = $this->getModelAttr('moderators');
 
 
         if (
         if (
             empty($attr)
             empty($attr)
@@ -303,7 +303,7 @@ class Forum extends DataModel
      */
      */
     public function modDelete(User ...$users): void
     public function modDelete(User ...$users): void
     {
     {
-        $attr = $this->getAttr('moderators');
+        $attr = $this->getModelAttr('moderators');
 
 
         if (
         if (
             empty($attr)
             empty($attr)
@@ -328,7 +328,7 @@ class Forum extends DataModel
      */
      */
     protected function gettree(): Forum
     protected function gettree(): Forum
     {
     {
-        $attr = $this->getAttr('tree');
+        $attr = $this->getModelAttr('tree');
 
 
         if (empty($attr)) { //????
         if (empty($attr)) { //????
             $numT   = (int) $this->num_topics;
             $numT   = (int) $this->num_topics;
@@ -362,7 +362,7 @@ class Forum extends DataModel
                 'newMessages'  => $fnew,
                 'newMessages'  => $fnew,
             ]);
             ]);
 
 
-            $this->setAttr('tree', $attr);
+            $this->setModelAttr('tree', $attr);
         }
         }
 
 
         return $attr;
         return $attr;
@@ -457,9 +457,9 @@ class Forum extends DataModel
     /**
     /**
      * Возвращает значения свойств в массиве
      * Возвращает значения свойств в массиве
      */
      */
-    public function getAttrs(): array
+    public function getModelAttrs(): array
     {
     {
-        $data = parent::getAttrs();
+        $data = parent::getModelAttrs();
 
 
         $data['moderators'] = empty($data['moderators']) || ! \is_array($data['moderators'])
         $data['moderators'] = empty($data['moderators']) || ! \is_array($data['moderators'])
             ? ''
             ? ''

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

@@ -34,7 +34,7 @@ class Forums extends Manager
      */
      */
     public function create(array $attrs = []): Forum
     public function create(array $attrs = []): Forum
     {
     {
-        return $this->c->ForumModel->setAttrs($attrs);
+        return $this->c->ForumModel->setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**

+ 2 - 2
app/Models/Forum/Save.php

@@ -31,7 +31,7 @@ class Save extends Action
             return $forum;
             return $forum;
         }
         }
 
 
-        $values = $forum->getAttrs();
+        $values = $forum->getModelAttrs();
         $fields = $this->c->dbMap->forums;
         $fields = $this->c->dbMap->forums;
         $set = $vars = [];
         $set = $vars = [];
 
 
@@ -88,7 +88,7 @@ class Save extends Action
             throw new RuntimeException('The model has ID');
             throw new RuntimeException('The model has ID');
         }
         }
 
 
-        $attrs  = $forum->getAttrs();
+        $attrs  = $forum->getModelAttrs();
         $fields = $this->c->dbMap->forums;
         $fields = $this->c->dbMap->forums;
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];
 
 

+ 1 - 1
app/Models/Group/Groups.php

@@ -30,7 +30,7 @@ class Groups extends Manager
      */
      */
     public function create(array $attrs = []): Group
     public function create(array $attrs = []): Group
     {
     {
-        return $this->c->GroupModel->setAttrs($attrs);
+        return $this->c->GroupModel->setModelAttrs($attrs);
     }
     }
 
 
     public function getList(): array
     public function getList(): array

+ 2 - 2
app/Models/Group/Save.php

@@ -31,7 +31,7 @@ class Save extends Action
             return $group;
             return $group;
         }
         }
 
 
-        $values = $group->getAttrs();
+        $values = $group->getModelAttrs();
         $fields = $this->c->dbMap->groups;
         $fields = $this->c->dbMap->groups;
 
 
         $set = $vars = [];
         $set = $vars = [];
@@ -77,7 +77,7 @@ class Save extends Action
             throw new RuntimeException('The model has ID');
             throw new RuntimeException('The model has ID');
         }
         }
 
 
-        $attrs  = $group->getAttrs();
+        $attrs  = $group->getModelAttrs();
         $fields = $this->c->dbMap->groups;
         $fields = $this->c->dbMap->groups;
 
 
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];

+ 4 - 4
app/Models/Model.php

@@ -88,7 +88,7 @@ class Model
      * Устанавливает значение для свойства
      * Устанавливает значение для свойства
      * Без вычислений, но со сбросом зависимых свойст и вычисленного значения
      * Без вычислений, но со сбросом зависимых свойст и вычисленного значения
      */
      */
-    public function setAttr(string $name, mixed $value): Model
+    public function setModelAttr(string $name, mixed $value): Model
     {
     {
         $this->unsetCalc($name);
         $this->unsetCalc($name);
         $this->zAttrs[$name] = $value;
         $this->zAttrs[$name] = $value;
@@ -100,7 +100,7 @@ class Model
      * Устанавливает значения для свойств
      * Устанавливает значения для свойств
      * Сбрасывает вычисленные свойства
      * Сбрасывает вычисленные свойства
      */
      */
-    public function setAttrs(array $attrs): Model
+    public function setModelAttrs(array $attrs): Model
     {
     {
         $this->zAttrs     = $attrs; //????
         $this->zAttrs     = $attrs; //????
         $this->zAttrsCalc = [];
         $this->zAttrsCalc = [];
@@ -142,7 +142,7 @@ class Model
      * Возвращает значение свойства
      * Возвращает значение свойства
      * Без вычислений
      * Без вычислений
      */
      */
-    public function getAttr(string $name, mixed $default = null): mixed
+    public function getModelAttr(string $name, mixed $default = null): mixed
     {
     {
         return \array_key_exists($name, $this->zAttrs) ? $this->zAttrs[$name] : $default;
         return \array_key_exists($name, $this->zAttrs) ? $this->zAttrs[$name] : $default;
     }
     }
@@ -151,7 +151,7 @@ class Model
      * Возвращает значения свойств в массиве
      * Возвращает значения свойств в массиве
      * Без вычислений
      * Без вычислений
      */
      */
-    public function getAttrs(): array
+    public function getModelAttrs(): array
     {
     {
         return $this->zAttrs;
         return $this->zAttrs;
     }
     }

+ 1 - 1
app/Models/PM/PBlock.php

@@ -40,7 +40,7 @@ class PBlock extends Model
 
 
     public function init(User $user): void
     public function init(User $user): void
     {
     {
-        $this->setAttrs([]);
+        $this->setModelAttrs([]);
 
 
         $this->repository = [];
         $this->repository = [];
         $this->user       = $user;
         $this->user       = $user;

+ 3 - 3
app/Models/PM/PM.php

@@ -97,9 +97,9 @@ class PM extends Model
     {
     {
         switch ($type) {
         switch ($type) {
             case Cnst::PTOPIC:
             case Cnst::PTOPIC:
-                return $this->c->PTopicModel->setAttrs($attrs);
+                return $this->c->PTopicModel->setModelAttrs($attrs);
             case Cnst::PPOST:
             case Cnst::PPOST:
-                return $this->c->PPostModel->setAttrs($attrs);
+                return $this->c->PPostModel->setModelAttrs($attrs);
             default:
             default:
                 throw new InvalidArgumentException("Wrong type: {$type}");
                 throw new InvalidArgumentException("Wrong type: {$type}");
         }
         }
@@ -403,7 +403,7 @@ class PM extends Model
                 $area = Cnst::ACTION_CURRENT;
                 $area = Cnst::ACTION_CURRENT;
         }
         }
 
 
-        $this->setAttr('area', $area);
+        $this->setModelAttr('area', $area);
 
 
         return $this;
         return $this;
     }
     }

+ 2 - 2
app/Models/PM/Save.php

@@ -41,7 +41,7 @@ class Save extends Method
             return $model;
             return $model;
         }
         }
 
 
-        $values = $model->getAttrs();
+        $values = $model->getModelAttrs();
         $fields = $this->c->dbMap->{$table};
         $fields = $this->c->dbMap->{$table};
 
 
         $set = $vars = [];
         $set = $vars = [];
@@ -83,7 +83,7 @@ class Save extends Method
             throw new InvalidArgumentException('Bad model');
             throw new InvalidArgumentException('Bad model');
         }
         }
 
 
-        $attrs  = $model->getAttrs();
+        $attrs  = $model->getModelAttrs();
         $fields = $this->c->dbMap->{$table};
         $fields = $this->c->dbMap->{$table};
 
 
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];

+ 4 - 4
app/Models/Page.php

@@ -437,10 +437,10 @@ abstract class Page extends Model
      */
      */
     public function settitles(string|array $value): void
     public function settitles(string|array $value): void
     {
     {
-        $attr   = $this->getAttr('titles', []);
+        $attr   = $this->getModelAttr('titles', []);
         $attr[] = $value;
         $attr[] = $value;
 
 
-        $this->setAttr('titles', $attr);
+        $this->setModelAttr('titles', $attr);
     }
     }
 
 
     /**
     /**
@@ -449,7 +449,7 @@ abstract class Page extends Model
      */
      */
     public function setfIswev(array $value): void
     public function setfIswev(array $value): void
     {
     {
-        $attr = $this->getAttr('fIswev', []);
+        $attr = $this->getModelAttr('fIswev', []);
 
 
         if (
         if (
             isset($value[0], $value[1])
             isset($value[0], $value[1])
@@ -461,7 +461,7 @@ abstract class Page extends Model
             $attr = \array_merge_recursive($attr, $value); // ???? добавить проверку?
             $attr = \array_merge_recursive($attr, $value); // ???? добавить проверку?
         }
         }
 
 
-        $this->setAttr('fIswev', $attr) ;
+        $this->setModelAttr('fIswev', $attr) ;
     }
     }
 
 
     /**
     /**

+ 2 - 2
app/Models/Poll/Polls.php

@@ -26,7 +26,7 @@ class Polls extends Manager
      */
      */
     public function create(array $attrs = []): Poll
     public function create(array $attrs = []): Poll
     {
     {
-        return $this->c->PollModel->setAttrs($attrs);
+        return $this->c->PollModel->setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**
@@ -45,7 +45,7 @@ class Polls extends Manager
                 $poll = $this->create($data);
                 $poll = $this->create($data);
             } else {
             } else {
                 $poll = $this->Load->load($id);
                 $poll = $this->Load->load($id);
-                $data = $poll instanceof Poll ? $poll->getAttrs() : null; // ????
+                $data = $poll instanceof Poll ? $poll->getModelAttrs() : null; // ????
 
 
                 $this->c->Cache->set("poll{$id}", $data);
                 $this->c->Cache->set("poll{$id}", $data);
             }
             }

+ 1 - 1
app/Models/Post/Posts.php

@@ -25,7 +25,7 @@ class Posts extends Manager
      */
      */
     public function create(array $attrs = []): Post
     public function create(array $attrs = []): Post
     {
     {
-        return $this->c->PostModel->setAttrs($attrs);
+        return $this->c->PostModel->setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**

+ 2 - 2
app/Models/Post/Save.php

@@ -31,7 +31,7 @@ class Save extends Action
             return $post;
             return $post;
         }
         }
 
 
-        $values = $post->getAttrs();
+        $values = $post->getModelAttrs();
         $fields = $this->c->dbMap->posts;
         $fields = $this->c->dbMap->posts;
         $set = $vars = [];
         $set = $vars = [];
 
 
@@ -70,7 +70,7 @@ class Save extends Action
             throw new RuntimeException('The model has ID');
             throw new RuntimeException('The model has ID');
         }
         }
 
 
-        $attrs  = $post->getAttrs();
+        $attrs  = $post->getModelAttrs();
         $fields = $this->c->dbMap->posts;
         $fields = $this->c->dbMap->posts;
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];
 
 

+ 1 - 1
app/Models/Provider/Driver.php

@@ -48,7 +48,7 @@ abstract class Driver extends Model
             throw new RuntimeException("Invalid name: {$name}");
             throw new RuntimeException("Invalid name: {$name}");
         }
         }
 
 
-        $this->setAttr('name', $name);
+        $this->setModelAttr('name', $name);
     }
     }
 
 
     /**
     /**

+ 1 - 1
app/Models/Report/Reports.php

@@ -29,7 +29,7 @@ class Reports extends Manager
      */
      */
     public function create(array $attrs = []): Report
     public function create(array $attrs = []): Report
     {
     {
-        return $this->c->ReportModel->setAttrs($attrs);
+        return $this->c->ReportModel->setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**

+ 2 - 2
app/Models/Report/Save.php

@@ -33,7 +33,7 @@ class Save extends Action
             return $report;
             return $report;
         }
         }
 
 
-        $values = $report->getAttrs();
+        $values = $report->getModelAttrs();
         $fields = $this->c->dbMap->reports;
         $fields = $this->c->dbMap->reports;
         $set = $vars = [];
         $set = $vars = [];
 
 
@@ -74,7 +74,7 @@ class Save extends Action
 
 
         $report->created = \time();
         $report->created = \time();
 
 
-        $attrs  = $report->getAttrs();
+        $attrs  = $report->getModelAttrs();
         $fields = $this->c->dbMap->reports;
         $fields = $this->c->dbMap->reports;
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];
 
 

+ 1 - 1
app/Models/Rules/Profile.php

@@ -24,7 +24,7 @@ class Profile extends Rules
      */
      */
     public function setUser(User $curUser): Profile
     public function setUser(User $curUser): Profile
     {
     {
-        $this->setAttrs([]);
+        $this->setModelAttrs([]);
 
 
         $this->ready       = true;
         $this->ready       = true;
         $this->user        = $this->c->user;
         $this->user        = $this->c->user;

+ 1 - 1
app/Models/Rules/Users.php

@@ -22,7 +22,7 @@ class Users extends Rules
      */
      */
     public function init(): Users
     public function init(): Users
     {
     {
-        $this->setAttrs([]);
+        $this->setModelAttrs([]);
 
 
         $this->ready = true;
         $this->ready = true;
         $this->user  = $this->c->user;
         $this->user  = $this->c->user;

+ 2 - 2
app/Models/Topic/Save.php

@@ -31,7 +31,7 @@ class Save extends Action
             return $topic;
             return $topic;
         }
         }
 
 
-        $values = $topic->getAttrs();
+        $values = $topic->getModelAttrs();
         $fields = $this->c->dbMap->topics;
         $fields = $this->c->dbMap->topics;
         $set = $vars = [];
         $set = $vars = [];
 
 
@@ -70,7 +70,7 @@ class Save extends Action
             throw new RuntimeException('The model has ID');
             throw new RuntimeException('The model has ID');
         }
         }
 
 
-        $attrs  = $topic->getAttrs();
+        $attrs  = $topic->getModelAttrs();
         $fields = $this->c->dbMap->topics;
         $fields = $this->c->dbMap->topics;
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];
 
 

+ 1 - 1
app/Models/Topic/Topics.php

@@ -25,7 +25,7 @@ class Topics extends Manager
      */
      */
     public function create(array $attrs = []): Topic
     public function create(array $attrs = []): Topic
     {
     {
-        return $this->c->TopicModel->setAttrs($attrs);
+        return $this->c->TopicModel->setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**

+ 2 - 2
app/Models/User/Save.php

@@ -34,7 +34,7 @@ class Save extends Action
             return $user;
             return $user;
         }
         }
 
 
-        $values = $user->getAttrs();
+        $values = $user->getModelAttrs();
 
 
         if ($user->isGuest) {
         if ($user->isGuest) {
             $fields = $this->c->dbMap->online;
             $fields = $this->c->dbMap->online;
@@ -115,7 +115,7 @@ class Save extends Action
         // вычисление username_normal для нового пользователя
         // вычисление username_normal для нового пользователя
         $user->username_normal = $this->manager->normUsername($user->username);
         $user->username_normal = $this->manager->normUsername($user->username);
 
 
-        $attrs  = $user->getAttrs();
+        $attrs  = $user->getModelAttrs();
         $fields = $this->c->dbMap->users;
         $fields = $this->c->dbMap->users;
         $set = $set2 = $vars = [];
         $set = $set2 = $vars = [];
 
 

+ 9 - 9
app/Models/User/User.php

@@ -118,7 +118,7 @@ class User extends DataModel
     protected function getlanguage(): string
     protected function getlanguage(): string
     {
     {
         $langs = $this->c->Func->getLangs();
         $langs = $this->c->Func->getLangs();
-        $lang  = $this->getAttr('language');
+        $lang  = $this->getModelAttr('language');
 
 
         if (
         if (
             empty($lang)
             empty($lang)
@@ -140,7 +140,7 @@ class User extends DataModel
     protected function getstyle(): string
     protected function getstyle(): string
     {
     {
         $styles = $this->c->Func->getStyles();
         $styles = $this->c->Func->getStyles();
-        $style  = $this->getAttr('style');
+        $style  = $this->getModelAttr('style');
 
 
         if (
         if (
             $this->isGuest
             $this->isGuest
@@ -180,7 +180,7 @@ class User extends DataModel
      */
      */
     protected function getavatar(): ?string
     protected function getavatar(): ?string
     {
     {
-        $file = $this->getAttr('avatar');
+        $file = $this->getModelAttr('avatar');
 
 
         if (! empty($file)) {
         if (! empty($file)) {
             $file = $this->c->config->o_avatars_dir . '/' . $file;
             $file = $this->c->config->o_avatars_dir . '/' . $file;
@@ -199,7 +199,7 @@ class User extends DataModel
      */
      */
     public function deleteAvatar(): void
     public function deleteAvatar(): void
     {
     {
-        $file = $this->getAttr('avatar');
+        $file = $this->getModelAttr('avatar');
 
 
         if (! empty($file)) {
         if (! empty($file)) {
             $path = $this->c->DIR_PUBLIC . "{$this->c->config->o_avatars_dir}/{$file}";
             $path = $this->c->DIR_PUBLIC . "{$this->c->config->o_avatars_dir}/{$file}";
@@ -313,7 +313,7 @@ class User extends DataModel
      */
      */
     protected function getdisp_topics(): int
     protected function getdisp_topics(): int
     {
     {
-        $attr = $this->getAttr('disp_topics');
+        $attr = $this->getModelAttr('disp_topics');
 
 
         if ($attr < 10) {
         if ($attr < 10) {
             $attr = $this->c->config->i_disp_topics_default;
             $attr = $this->c->config->i_disp_topics_default;
@@ -327,7 +327,7 @@ class User extends DataModel
      */
      */
     protected function getdisp_posts(): int
     protected function getdisp_posts(): int
     {
     {
-        $attr = $this->getAttr('disp_topics');
+        $attr = $this->getModelAttr('disp_topics');
 
 
         if ($attr < 10) {
         if ($attr < 10) {
             $attr = $this->c->config->i_disp_posts_default;
             $attr = $this->c->config->i_disp_posts_default;
@@ -384,15 +384,15 @@ class User extends DataModel
     /**
     /**
      * Возвращает значения свойств в массиве
      * Возвращает значения свойств в массиве
      */
      */
-    public function getAttrs(): array
+    public function getModelAttrs(): array
     {
     {
         foreach (['email_normal', 'username_normal'] as $key) {
         foreach (['email_normal', 'username_normal'] as $key) {
             if (isset($this->zModFlags[$key])) {
             if (isset($this->zModFlags[$key])) {
-                $this->setAttr($key, $this->$key);
+                $this->setModelAttr($key, $this->$key);
             }
             }
         }
         }
 
 
-        return parent::getAttrs();
+        return parent::getModelAttrs();
     }
     }
 
 
     /**
     /**

+ 2 - 2
app/Models/User/Users.php

@@ -28,7 +28,7 @@ class Users extends Manager
      */
      */
     public function create(array $attrs = []): User
     public function create(array $attrs = []): User
     {
     {
-        return $this->c->UserModel->setAttrs($attrs);
+        return $this->c->UserModel->setModelAttrs($attrs);
     }
     }
 
 
     /**
     /**
@@ -150,7 +150,7 @@ class Users extends Manager
         $cache = $this->c->Cache->get(self::CACHE_KEY);
         $cache = $this->c->Cache->get(self::CACHE_KEY);
 
 
         if (! \is_array($cache)) {
         if (! \is_array($cache)) {
-            $cache = $this->c->groups->get(FORK_GROUP_GUEST)->getAttrs();
+            $cache = $this->c->groups->get(FORK_GROUP_GUEST)->getModelAttrs();
 
 
             if (true !== $this->c->Cache->set(self::CACHE_KEY, $cache)) {
             if (true !== $this->c->Cache->set(self::CACHE_KEY, $cache)) {
                 throw new RuntimeException('Unable to write value to cache - ' . self::CACHE_KEY);
                 throw new RuntimeException('Unable to write value to cache - ' . self::CACHE_KEY);

+ 1 - 1
app/Models/Validators/Email.php

@@ -149,7 +149,7 @@ class Email extends RulesValidator
             && $user instanceof User
             && $user instanceof User
             && ! $user->isGuest
             && ! $user->isGuest
         ) {
         ) {
-            $originalUser->setAttrs($user->getAttrs());
+            $originalUser->setModelAttrs($user->getModelAttrs());
         }
         }
 
 
         return $email;
         return $email;