@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @deprecated |
61 | - * @return \Illuminate\Database\Eloquent\Collection|mixed |
|
61 | + * @return \Illuminate\Database\Eloquent\Collection |
|
62 | 62 | * @throws SyntaxException |
63 | 63 | */ |
64 | 64 | public static function getAll() |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * Get single row by defined type and sys_name with query caching |
89 | 89 | * @param string $type |
90 | 90 | * @param string|array $name |
91 | - * @return mixed|null |
|
91 | + * @return App |
|
92 | 92 | * @throws SyntaxException |
93 | 93 | */ |
94 | 94 | public static function getItem($type, $name) |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Ffcms\Core\Exception\SyntaxException; |
8 | 8 | use Ffcms\Core\Helper\Type\Any; |
9 | 9 | use Ffcms\Core\Helper\Type\Arr; |
10 | -use Ffcms\Core\Helper\Type\Obj; |
|
11 | 10 | use Ffcms\Core\Helper\Type\Str; |
12 | 11 | |
13 | 12 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function all($columns = ['*']) |
45 | 45 | { |
46 | - $cacheName = 'activercord.app.all.' . implode('.', $columns); |
|
46 | + $cacheName = 'activercord.app.all.'.implode('.', $columns); |
|
47 | 47 | $records = MemoryObject::instance()->get($cacheName); |
48 | 48 | if ($records === null) { |
49 | 49 | $records = parent::all($columns); |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function getScriptVersion() |
183 | 183 | { |
184 | - $class = 'Apps\Controller\Admin\\' . $this->sys_name; |
|
184 | + $class = 'Apps\Controller\Admin\\'.$this->sys_name; |
|
185 | 185 | if (!class_exists($class)) { |
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | |
189 | - if (!defined($class . '::VERSION')) { |
|
189 | + if (!defined($class.'::VERSION')) { |
|
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | |
193 | - return constant($class . '::VERSION'); |
|
193 | + return constant($class.'::VERSION'); |
|
194 | 194 | } |
195 | 195 | } |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Ffcms\Core\Helper\FileSystem\File; |
8 | 8 | use Ffcms\Core\Helper\Type\Any; |
9 | 9 | use Ffcms\Core\Helper\Type\Arr; |
10 | -use Ffcms\Core\Helper\Type\Obj; |
|
11 | 10 | use Ffcms\Core\Helper\Type\Str; |
12 | 11 | use Ffcms\Core\Interfaces\iProfile; |
13 | 12 |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // check in cache |
64 | - if (MainApp::$Memory->get('profile.object.cache.' . $userId) !== null) { |
|
65 | - return MainApp::$Memory->get('profile.object.cache.' . $userId); |
|
64 | + if (MainApp::$Memory->get('profile.object.cache.'.$userId) !== null) { |
|
65 | + return MainApp::$Memory->get('profile.object.cache.'.$userId); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // find row |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $object = $profile->first(); |
77 | 77 | |
78 | - MainApp::$Memory->set('profile.object.cache.' . $userId, $object); |
|
78 | + MainApp::$Memory->set('profile.object.cache.'.$userId, $object); |
|
79 | 79 | return $object; |
80 | 80 | } |
81 | 81 | |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getAvatarUrl($type = 'small') |
88 | 88 | { |
89 | - $default = '/upload/user/avatar/' . $type . '/default.jpg'; |
|
89 | + $default = '/upload/user/avatar/'.$type.'/default.jpg'; |
|
90 | 90 | if (!Arr::in($type, ['small', 'big', 'medium'])) { |
91 | - return MainApp::$Alias->scriptUrl . $default; |
|
91 | + return MainApp::$Alias->scriptUrl.$default; |
|
92 | 92 | } |
93 | 93 | |
94 | - $route = '/upload/user/avatar/' . $type . '/' . $this->user_id . '.jpg'; |
|
94 | + $route = '/upload/user/avatar/'.$type.'/'.$this->user_id.'.jpg'; |
|
95 | 95 | if (File::exist($route)) { |
96 | - return MainApp::$Alias->scriptUrl . $route . '?mtime=' . File::mTime($route); |
|
96 | + return MainApp::$Alias->scriptUrl.$route.'?mtime='.File::mTime($route); |
|
97 | 97 | } |
98 | 98 | |
99 | - return MainApp::$Alias->scriptUrl . $default; |
|
99 | + return MainApp::$Alias->scriptUrl.$default; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $userNick = $this->nick; |
109 | 109 | if ($userNick === null || Str::likeEmpty($userNick)) { |
110 | - $userNick = 'id' . $this->id; |
|
110 | + $userNick = 'id'.$this->id; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $userNick; |
@@ -168,7 +168,7 @@ |
||
168 | 168 | /** |
169 | 169 | * Get user person like a object via email |
170 | 170 | * @param string|null $email |
171 | - * @return null|self |
|
171 | + * @return null|ActiveModel |
|
172 | 172 | */ |
173 | 173 | public static function getIdentityViaEmail(?string $email = null) |
174 | 174 | { |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ffcms\Core\App as MainApp; |
6 | 6 | use Ffcms\Core\Arch\ActiveModel; |
7 | 7 | use Ffcms\Core\Helper\Type\Any; |
8 | -use Ffcms\Core\Helper\Type\Obj; |
|
9 | 8 | use Ffcms\Core\Helper\Type\Str; |
10 | 9 | use Ffcms\Core\Interfaces\iUser; |
11 | 10 |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | // check if id is looks like integer |
53 | - if (!Any::isInt($id) || (int)$id < 1) { |
|
53 | + if (!Any::isInt($id) || (int) $id < 1) { |
|
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | |
57 | 57 | // check in memory cache object |
58 | - if (MainApp::$Memory->get('user.object.cache.' . $id) !== null) { |
|
59 | - return MainApp::$Memory->get('user.object.cache.' . $id); |
|
58 | + if (MainApp::$Memory->get('user.object.cache.'.$id) !== null) { |
|
59 | + return MainApp::$Memory->get('user.object.cache.'.$id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // not founded in memory? lets make query |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ->find($id); |
65 | 65 | |
66 | 66 | // store cache and return object |
67 | - MainApp::$Memory->set('user.object.cache.' . $user->id, $user); |
|
67 | + MainApp::$Memory->set('user.object.cache.'.$user->id, $user); |
|
68 | 68 | return $user; |
69 | 69 | } |
70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getId(): ?int |
76 | 76 | { |
77 | - return (int)$this->id; |
|
77 | + return (int) $this->id; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public static function isAuth(): bool |
96 | 96 | { |
97 | 97 | // get data from session |
98 | - $sessionUserId = (int)MainApp::$Session->get('ff_user_id', 0); |
|
98 | + $sessionUserId = (int) MainApp::$Session->get('ff_user_id', 0); |
|
99 | 99 | |
100 | 100 | // check if session contains user id data |
101 | 101 | if ($sessionUserId < 1) { |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
131 | - $find = MainApp::$Memory->get('user.counter.cache.' . $id); |
|
131 | + $find = MainApp::$Memory->get('user.counter.cache.'.$id); |
|
132 | 132 | if (!$find) { |
133 | 133 | $find = self::where('id', $id)->count(); |
134 | - MainApp::$Memory->set('user.counter.cache.' . $id, $find); |
|
134 | + MainApp::$Memory->set('user.counter.cache.'.$id, $find); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $find === 1; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function inBlacklist(?string $target = null): bool |
233 | 233 | { |
234 | - if ($target === null || (int)$target < 1) { |
|
234 | + if ($target === null || (int) $target < 1) { |
|
235 | 235 | return false; |
236 | 236 | } |
237 | 237 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | |
6 | 6 | use Ffcms\Console\Command; |
7 | 7 | use Ffcms\Core\Helper\FileSystem\File; |
8 | -use Ffcms\Core\Helper\Type\Obj; |
|
9 | 8 | use Ffcms\Core\Helper\Type\Str; |
10 | 9 | use Symfony\Component\Console\Input\InputArgument; |
11 | 10 | use Symfony\Component\Console\Input\InputInterface; |
@@ -58,9 +58,9 @@ |
||
58 | 58 | // work with migration template: read & parse & save |
59 | 59 | $tpl = File::read('/Private/Carcase/Migration.tphp'); |
60 | 60 | $classContent = Str::replace(['%class%', '%table%'], [$name, $table], $tpl); |
61 | - $fullPath = $dir . $name . '-' . $suffix . '.php'; |
|
61 | + $fullPath = $dir.$name.'-'.$suffix.'.php'; |
|
62 | 62 | File::write($fullPath, $classContent); |
63 | 63 | // show success msg |
64 | - $output->write('New migration is created: ' . $fullPath); |
|
64 | + $output->write('New migration is created: '.$fullPath); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -5,10 +5,7 @@ |
||
5 | 5 | |
6 | 6 | use Apps\ActiveRecord\Migration; |
7 | 7 | use Ffcms\Console\Command; |
8 | -use Ffcms\Core\Helper\FileSystem\File; |
|
9 | 8 | use Ffcms\Core\Helper\Type\Any; |
10 | -use Ffcms\Core\Helper\Type\Obj; |
|
11 | -use Ffcms\Core\Helper\Type\Str; |
|
12 | 9 | use Ffcms\Core\Managers\MigrationsManager; |
13 | 10 | use Symfony\Component\Console\Input\InputArgument; |
14 | 11 | use Symfony\Component\Console\Input\InputInterface; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | // list found migrations and ask to revert each one |
52 | 52 | $fired = false; |
53 | 53 | foreach ($search as $migration) { |
54 | - if (!$this->confirm('Are you sure to revert: ' . $migration)) { |
|
54 | + if (!$this->confirm('Are you sure to revert: '.$migration)) { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | // run down migration |
@@ -3,13 +3,8 @@ |
||
3 | 3 | namespace Apps\Console; |
4 | 4 | |
5 | 5 | |
6 | -use Apps\ActiveRecord\Migration; |
|
7 | 6 | use Ffcms\Console\Command; |
8 | -use Ffcms\Core\Helper\FileSystem\File; |
|
9 | 7 | use Ffcms\Core\Helper\Type\Any; |
10 | -use Ffcms\Core\Helper\Type\Arr; |
|
11 | -use Ffcms\Core\Helper\Type\Obj; |
|
12 | -use Ffcms\Core\Helper\Type\Str; |
|
13 | 8 | use Ffcms\Core\Managers\MigrationsManager; |
14 | 9 | use Symfony\Component\Console\Input\InputArgument; |
15 | 10 | use Symfony\Component\Console\Input\InputInterface; |
@@ -51,11 +51,11 @@ |
||
51 | 51 | // require confirmation from user each ever migration file |
52 | 52 | $fired = false; |
53 | 53 | foreach ($search as $migration) { |
54 | - if (!$this->confirm('Are you sure to apply migration: ' . $migration, true)) { |
|
54 | + if (!$this->confirm('Are you sure to apply migration: '.$migration, true)) { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | $manager->makeUp($migration); |
58 | - $fired = true; |
|
58 | + $fired = true; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($fired) { |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use Ffcms\Core\Helper\HTML\SimplePagination; |
15 | 15 | use Ffcms\Core\Helper\Type\Any; |
16 | 16 | use Ffcms\Core\Helper\Type\Arr; |
17 | -use Ffcms\Core\Helper\Type\Obj; |
|
18 | 17 | |
19 | 18 | /** |
20 | 19 | * Class Comments. Admin controller for management user comments. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function actionIndex() |
41 | 41 | { |
42 | 42 | // set current page and offset |
43 | - $page = (int)$this->request->query->get('page'); |
|
43 | + $page = (int) $this->request->query->get('page'); |
|
44 | 44 | $offset = $page * self::ITEM_PER_PAGE; |
45 | 45 | |
46 | 46 | // initialize active record model |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function actionDelete($type, $id = 0) |
144 | 144 | { |
145 | 145 | // sounds like a multiply delete definition |
146 | - if ($id === 0 || (int)$id < 1) { |
|
146 | + if ($id === 0 || (int) $id < 1) { |
|
147 | 147 | $ids = $this->request->query->get('selected'); |
148 | 148 | if (!Any::isArray($ids) || !Arr::onlyNumericValues($ids)) { |
149 | 149 | throw new NotFoundException('Bad conditions'); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if ($model->send() && $model->validate()) { |
178 | 178 | $model->make(); |
179 | 179 | App::$Session->getFlashBag()->add('success', __('Comments or answers are successful deleted!')); |
180 | - $this->response->redirect('comments/' . ($type === 'answer' ? 'answerlist' : 'index')); |
|
180 | + $this->response->redirect('comments/'.($type === 'answer' ? 'answerlist' : 'index')); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // render view |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | public function actionPublish($type, $id = 0) |
199 | 199 | { |
200 | 200 | // check if it multiple accept ids |
201 | - if ($id === 0 || (int)$id < 1) { |
|
201 | + if ($id === 0 || (int) $id < 1) { |
|
202 | 202 | $ids = $this->request->query->get('selected'); |
203 | 203 | if (!Any::isArray($ids) || !Arr::onlyNumericValues($ids)) { |
204 | 204 | throw new NotFoundException('Bad conditions'); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($model->send()) { |
232 | 232 | $model->make(); |
233 | 233 | App::$Session->getFlashBag()->add('success', __('Comments or answers are successful published')); |
234 | - $this->response->redirect('comments/' . ($type === 'answer' ? 'answerlist' : 'index')); |
|
234 | + $this->response->redirect('comments/'.($type === 'answer' ? 'answerlist' : 'index')); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $this->view->render('publish', [ |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | public function actionAnswerlist() |
249 | 249 | { |
250 | 250 | // set current page and offset |
251 | - $page = (int)$this->request->query->get('page'); |
|
251 | + $page = (int) $this->request->query->get('page'); |
|
252 | 252 | $offset = $page * self::ITEM_PER_PAGE; |
253 | 253 | |
254 | 254 | // initialize ar answers model |
@@ -21,7 +21,6 @@ |
||
21 | 21 | use Ffcms\Core\Exception\SyntaxException; |
22 | 22 | use Ffcms\Core\Helper\HTML\SimplePagination; |
23 | 23 | use Ffcms\Core\Helper\Type\Any; |
24 | -use Ffcms\Core\Helper\Type\Obj; |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * Class Content. Admin controller to manage & control contents |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function actionIndex() |
44 | 44 | { |
45 | 45 | // set current page and offset |
46 | - $page = (int)$this->request->query->get('page'); |
|
46 | + $page = (int) $this->request->query->get('page'); |
|
47 | 47 | $offset = $page * self::ITEM_PER_PAGE; |
48 | 48 | |
49 | 49 | $query = null; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } elseif ($type === 'moderate') { // only items on moderate |
55 | 55 | $query = ContentEntity::where('display', '=', 0); |
56 | 56 | } elseif (Any::isInt($type)) { // sounds like category id ;) |
57 | - $query = ContentEntity::where('category_id', '=', (int)$type); |
|
57 | + $query = ContentEntity::where('category_id', '=', (int) $type); |
|
58 | 58 | } else { |
59 | 59 | $query = new ContentEntity(); |
60 | 60 | $type = 'all'; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function actionCategoryupdate($id = null) |
265 | 265 | { |
266 | 266 | // get owner id for new rows |
267 | - $parentId = (int)$this->request->query->get('parent'); |
|
267 | + $parentId = (int) $this->request->query->get('parent'); |
|
268 | 268 | |
269 | 269 | // get relation and pass to model |
270 | 270 | $record = ContentCategory::findOrNew($id); |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use Ffcms\Core\Exception\NativeException; |
15 | 15 | use Ffcms\Core\Exception\NotFoundException; |
16 | 16 | use Ffcms\Core\Helper\Type\Any; |
17 | -use Ffcms\Core\Helper\Type\Obj; |
|
18 | 17 | use Ffcms\Core\Helper\Type\Str; |
19 | 18 | |
20 | 19 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->setJsonHeader(); |
34 | 34 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
35 | 35 | |
36 | - $replayTo = (int)$this->request->request->get('replay-to'); |
|
36 | + $replayTo = (int) $this->request->request->get('replay-to'); |
|
37 | 37 | $model = null; |
38 | 38 | // check if its a answer (comment answer type) |
39 | 39 | if ($replayTo > 0) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | // pass general comment params to model |
48 | - $model->message = App::$Security->secureHtml((string)$this->request->request->get('message')); |
|
48 | + $model->message = App::$Security->secureHtml((string) $this->request->request->get('message')); |
|
49 | 49 | $model->guestName = App::$Security->strip_tags($this->request->request->get('guest-name')); |
50 | 50 | |
51 | 51 | // check model conditions before add new row |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | // get configs |
78 | 78 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
79 | 79 | // items per page |
80 | - $perPage = (int)$configs['perPage']; |
|
80 | + $perPage = (int) $configs['perPage']; |
|
81 | 81 | // offset can be only integer |
82 | - $index = (int)$index; |
|
82 | + $index = (int) $index; |
|
83 | 83 | $offset = $perPage * $index; |
84 | 84 | // get comment target path and check |
85 | - $path = (string)$this->request->query->get('path'); |
|
85 | + $path = (string) $this->request->query->get('path'); |
|
86 | 86 | if (Str::likeEmpty($path)) { |
87 | 87 | throw new NotFoundException('Wrong path'); |
88 | 88 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ->where('moderate', '=', 0); |
93 | 93 | |
94 | 94 | // check if comments is depend of language locale |
95 | - if ((bool)$configs['onlyLocale'] === true) { |
|
95 | + if ((bool) $configs['onlyLocale'] === true) { |
|
96 | 96 | $query = $query->where('lang', '=', $this->request->getLanguage()); |
97 | 97 | } |
98 | 98 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | // calculate comments left count |
122 | 122 | $countQuery = CommentPost::where('pathway', '=', $path)->where('moderate', '=', 0); |
123 | 123 | // check if comments is depend of language locale |
124 | - if ((bool)$configs['onlyLocale'] === true) { |
|
124 | + if ((bool) $configs['onlyLocale'] === true) { |
|
125 | 125 | $countQuery = $countQuery->where('lang', '=', $this->request->getLanguage()); |
126 | 126 | } |
127 | 127 | $count = $countQuery->count(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $records = CommentAnswer::with(['user', 'user.profile', 'user.role']) |
161 | 161 | ->where('comment_id', '=', $commentId) |
162 | 162 | ->where('moderate', '=', 0); |
163 | - if ((int)$configs['onlyLocale'] === 1) { |
|
163 | + if ((int) $configs['onlyLocale'] === 1) { |
|
164 | 164 | $records = $records->where('lang', '=', $this->request->getLanguage()); |
165 | 165 | } |
166 | 166 | |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | foreach ($path as $id => $uri) { |
206 | 206 | $query = CommentPost::where('pathway', '=', $uri)->where('moderate', '=', 0); |
207 | 207 | // check if comments is depend of language locale |
208 | - if ((int)$configs['onlyLocale'] === 1) { |
|
208 | + if ((int) $configs['onlyLocale'] === 1) { |
|
209 | 209 | $query = $query->where('lang', '=', $this->request->getLanguage()); |
210 | 210 | } |
211 | 211 | // set itemId => count |
212 | - $count[(int)$id] = $query->count(); |
|
212 | + $count[(int) $id] = $query->count(); |
|
213 | 213 | } |
214 | 214 | // render json response |
215 | 215 | return json_encode(['status' => 1, 'count' => $count]); |