@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function boot(): void |
| 26 | 26 | { |
| 27 | - App::$Event->on(Main::SEARCH_EVENT_NAME, function ($model) { |
|
| 27 | + App::$Event->on(Main::SEARCH_EVENT_NAME, function($model) { |
|
| 28 | 28 | /** @var CollectionSearchResults $model */ |
| 29 | 29 | $records = CommentPost::search($model->getQuery()) |
| 30 | 30 | ->take($model->getLimit()) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $res->setTitle($title); |
| 42 | 42 | $res->setSnippet($text); |
| 43 | 43 | $res->setDate($item->created_at); |
| 44 | - $res->setRelevance((int)$item->relevance); |
|
| 44 | + $res->setRelevance((int) $item->relevance); |
|
| 45 | 45 | $res->setUrl('comments/read', [$item->id]); |
| 46 | 46 | $res->setMarker('Comment'); |
| 47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $res->setTitle($title); |
| 65 | 65 | $res->setSnippet($text); |
| 66 | 66 | $res->setDate($item->created_at); |
| 67 | - $res->setRelevance((int)$item->relevance); |
|
| 67 | + $res->setRelevance((int) $item->relevance); |
|
| 68 | 68 | $res->setUrl('comments/read', [$item->comment_id]); |
| 69 | 69 | $res->setMarker('Comment'); |
| 70 | 70 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public static function boot(): void |
| 24 | 24 | { |
| 25 | - App::$Event->on(Main::SEARCH_EVENT_NAME, function ($model) { |
|
| 25 | + App::$Event->on(Main::SEARCH_EVENT_NAME, function($model) { |
|
| 26 | 26 | /** @var CollectionSearchResults $model */ |
| 27 | 27 | $records = User::with('profile') |
| 28 | 28 | ->search($model->getQuery()) |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | /** @var User[]|Collection $records */ |
| 33 | 33 | $records->each(function($item) use ($model) { |
| 34 | 34 | /** @var User $item */ |
| 35 | - $title = $item->login . '(' . $item->email . ')'; |
|
| 35 | + $title = $item->login.'('.$item->email.')'; |
|
| 36 | 36 | $text = App::$Translate->get('User', 'Login: %login%, email: %email%, nick: %nick%', [ |
| 37 | 37 | 'login' => $item->login, |
| 38 | 38 | 'email' => $item->email, |
| 39 | - 'nick' => $item->profile->nick ?? 'id' . $item->id |
|
| 39 | + 'nick' => $item->profile->nick ?? 'id'.$item->id |
|
| 40 | 40 | ]); |
| 41 | 41 | |
| 42 | 42 | // initialize abstract response pattern |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $res->setTitle($title); |
| 45 | 45 | $res->setSnippet($text); |
| 46 | 46 | $res->setDate($item->created_at); |
| 47 | - $res->setRelevance((int)$item->relevance); |
|
| 47 | + $res->setRelevance((int) $item->relevance); |
|
| 48 | 48 | $res->setUrl('user/update', [$item->id]); |
| 49 | 49 | $res->setMarker('User'); |
| 50 | 50 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public static function boot(): void |
| 22 | 22 | { |
| 23 | - App::$Event->on(Main::SEARCH_EVENT_NAME, function ($model) { |
|
| 23 | + App::$Event->on(Main::SEARCH_EVENT_NAME, function($model) { |
|
| 24 | 24 | /** @var CollectionSearchResults $model */ |
| 25 | 25 | $records = \Apps\ActiveRecord\App::search($model->getQuery()) |
| 26 | 26 | ->take($model->getLimit()) |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | $res->setTitle($item->getLocaled('name')); |
| 41 | 41 | $res->setSnippet($text); |
| 42 | 42 | $res->setDate($item->created_at); |
| 43 | - $res->setRelevance((int)$item->relevance); |
|
| 44 | - $res->setUrl(Str::lowerCase($item->sys_name) . '/index'); |
|
| 43 | + $res->setRelevance((int) $item->relevance); |
|
| 44 | + $res->setUrl(Str::lowerCase($item->sys_name).'/index'); |
|
| 45 | 45 | $res->setMarker('App'); |
| 46 | 46 | |
| 47 | 47 | $model->add($res); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $files = File::listFiles('/I18n/Admin/' . $usedLanguage, ['.php']); |
|
| 68 | + $files = File::listFiles('/I18n/Admin/'.$usedLanguage, ['.php']); |
|
| 69 | 69 | // each translation files |
| 70 | 70 | foreach ($files as $file) { |
| 71 | 71 | // prepare file name and route target |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $filter = array_filter($lines, function($target, $en) use ($usedWords, $onlyKeys) { |
| 83 | 83 | $enWords = explode(' ', $en); |
| 84 | 84 | foreach ($enWords as $enWord) { |
| 85 | - if(Arr::in($enWord, $usedWords)) { |
|
| 85 | + if (Arr::in($enWord, $usedWords)) { |
|
| 86 | 86 | return true; |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $res->setSnippet(implode('; ', $filter)); |
| 111 | 111 | $res->setDate(time()); |
| 112 | 112 | $res->setRelevance($relevance); |
| 113 | - $res->setUrl($route . '/index'); |
|
| 113 | + $res->setUrl($route.'/index'); |
|
| 114 | 114 | $res->setMarker('i18n'); |
| 115 | 115 | |
| 116 | 116 | $model->add($res); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | case 'answer': |
| 45 | 45 | $record = FeedbackAnswer::find($id); |
| 46 | 46 | if ($record) { |
| 47 | - $postId = (int)$record->post->id; |
|
| 47 | + $postId = (int) $record->post->id; |
|
| 48 | 48 | } |
| 49 | 49 | break; |
| 50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if ($model->validate()) { |
| 61 | 61 | $model->make(); |
| 62 | 62 | App::$Session->getFlashBag()->add('success', __('Feedback item are successful changed')); |
| 63 | - $this->response->redirect('feedback/read/' . $postId); |
|
| 63 | + $this->response->redirect('feedback/read/'.$postId); |
|
| 64 | 64 | } else { |
| 65 | 65 | App::$Session->getFlashBag()->add('danger', __('Updating is failed')); |
| 66 | 66 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public static function boot(): void |
| 21 | 21 | { |
| 22 | - App::$Event->on(Main::SEARCH_EVENT_NAME, function ($model) { |
|
| 22 | + App::$Event->on(Main::SEARCH_EVENT_NAME, function($model) { |
|
| 23 | 23 | /** @var CollectionSearchResults $model */ |
| 24 | 24 | $records = FeedbackPost::search($model->getQuery()) |
| 25 | 25 | ->take($model->getLimit()) |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $res->setTitle($title); |
| 37 | 37 | $res->setSnippet($snippet); |
| 38 | 38 | $res->setDate($item->created_at); |
| 39 | - $res->setRelevance((int)$item->relevance); |
|
| 39 | + $res->setRelevance((int) $item->relevance); |
|
| 40 | 40 | $res->setUrl('feedback/read', [$item->id]); |
| 41 | 41 | $res->setMarker('Feedback'); |
| 42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $records = FeedbackAnswer::search($model->getQuery()) |
| 48 | 48 | ->take($model->getLimit()) |
| 49 | 49 | ->get(); |
| 50 | - $records->each(function ($item) use ($model) { |
|
| 50 | + $records->each(function($item) use ($model) { |
|
| 51 | 51 | /** @var FeedbackAnswer $item */ |
| 52 | 52 | $title = App::$Translate->get('Feedback', 'Feedback answer #%id%', ['id' => $item->id]); |
| 53 | 53 | $text = App::$Security->strip_tags($item->message); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $res->setTitle($title); |
| 59 | 59 | $res->setSnippet($snippet); |
| 60 | 60 | $res->setDate($item->created_at); |
| 61 | - $res->setRelevance((int)$item->relevance); |
|
| 61 | + $res->setRelevance((int) $item->relevance); |
|
| 62 | 62 | $res->setUrl('feedback/read', [$item->feedback_id]); |
| 63 | 63 | $res->setMarker('Feedback'); |
| 64 | 64 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function boot(): void |
| 27 | 27 | { |
| 28 | - App::$Event->on(Main::SEARCH_EVENT_NAME, function ($model) { |
|
| 28 | + App::$Event->on(Main::SEARCH_EVENT_NAME, function($model) { |
|
| 29 | 29 | /** @var CollectionSearchResults $model */ |
| 30 | 30 | $limit = $model->getLimit(); |
| 31 | 31 | $query = $model->getQuery(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $res->setTitle($title); |
| 52 | 52 | $res->setSnippet($snippet); |
| 53 | 53 | $res->setDate($item->created_at); |
| 54 | - $res->setRelevance((int)$item->relevance); |
|
| 54 | + $res->setRelevance((int) $item->relevance); |
|
| 55 | 55 | $res->setUrl('content/update', [$item->id]); |
| 56 | 56 | $res->setMarker('Content'); |
| 57 | 57 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $res->setTitle($title); |
| 79 | 79 | $res->setSnippet($snippet); |
| 80 | 80 | $res->setDate($item->created_at); |
| 81 | - $res->setRelevance((int)$item->relevance); |
|
| 81 | + $res->setRelevance((int) $item->relevance); |
|
| 82 | 82 | $res->setUrl('content/categoryupdate', [$item->id]); |
| 83 | 83 | $res->setMarker('Content'); |
| 84 | 84 | |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function boot(): void |
| 27 | 27 | { |
| 28 | - App::$Event->on(Search::EVENT_SEARCH_RUN, function ($model) { |
|
| 28 | + App::$Event->on(Search::EVENT_SEARCH_RUN, function($model) { |
|
| 29 | 29 | /** @var EntitySearchMain $model */ |
| 30 | - $limit = (int)$model->getConfigs()['itemPerApp']; |
|
| 30 | + $limit = (int) $model->getConfigs()['itemPerApp']; |
|
| 31 | 31 | if ($limit < 1) { |
| 32 | 32 | $limit = 1; |
| 33 | 33 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $res->setTitle($title); |
| 55 | 55 | $res->setSnippet($snippet); |
| 56 | 56 | $res->setDate($item->created_at); |
| 57 | - $res->setRelevance((int)$item->relevance); |
|
| 58 | - $res->setUri('/content/read/' . $item->getPath()); |
|
| 57 | + $res->setRelevance((int) $item->relevance); |
|
| 58 | + $res->setUri('/content/read/'.$item->getPath()); |
|
| 59 | 59 | |
| 60 | 60 | $model->add($res); |
| 61 | 61 | }); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function boot(): void |
| 26 | 26 | { |
| 27 | - App::$Event->on(Search::EVENT_SEARCH_RUN, function ($model) { |
|
| 27 | + App::$Event->on(Search::EVENT_SEARCH_RUN, function($model) { |
|
| 28 | 28 | /** @var EntitySearchMain $model */ |
| 29 | - $limit = (int)$model->getConfigs()['itemPerApp']; |
|
| 29 | + $limit = (int) $model->getConfigs()['itemPerApp']; |
|
| 30 | 30 | if ($limit < 1) { |
| 31 | 31 | $limit = 1; |
| 32 | 32 | } |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | $instance = new AbstractSearchResult(); |
| 47 | 47 | $instance->setTitle(App::$Translate->get('Search', 'Comment on the page')); |
| 48 | 48 | $instance->setSnippet($snippet); |
| 49 | - $instance->setUri('/' . $item->app_name . '/comments/' . $item->app_relation_id); |
|
| 49 | + $instance->setUri('/'.$item->app_name.'/comments/'.$item->app_relation_id); |
|
| 50 | 50 | $instance->setDate($item->created_at); |
| 51 | - $instance->setRelevance((int)$item->relevance); |
|
| 51 | + $instance->setRelevance((int) $item->relevance); |
|
| 52 | 52 | |
| 53 | 53 | // add instance to result set |
| 54 | 54 | $model->add($instance); |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | public function actionIndex() |
| 27 | 27 | { |
| 28 | 28 | // get search query value from GET headers |
| 29 | - $query = (string)$this->request->query->get('query', null); |
|
| 29 | + $query = (string) $this->request->query->get('query', null); |
|
| 30 | 30 | // strip html tags |
| 31 | 31 | $query = App::$Security->strip_tags(trim($query)); |
| 32 | 32 | // get configs |
| 33 | 33 | $configs = $this->getConfigs(); |
| 34 | 34 | |
| 35 | 35 | // check search query length |
| 36 | - if (!Any::isStr($query) || Str::likeEmpty($query) || Str::length($query) < (int)$configs['minLength']) { |
|
| 36 | + if (!Any::isStr($query) || Str::likeEmpty($query) || Str::length($query) < (int) $configs['minLength']) { |
|
| 37 | 37 | throw new NotFoundException(__('Search query is too short!')); |
| 38 | 38 | } |
| 39 | 39 | |