@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $this->setJsonHeader(); |
| 33 | 33 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
| 34 | 34 | |
| 35 | - $replayTo = (int)App::$Request->request->get('replay-to'); |
|
| 35 | + $replayTo = (int) App::$Request->request->get('replay-to'); |
|
| 36 | 36 | $model = null; |
| 37 | 37 | // check if its a answer (comment answer type) |
| 38 | 38 | if ($replayTo > 0) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // pass general comment params to model |
| 47 | - $model->message = App::$Security->secureHtml((string)App::$Request->request->get('message')); |
|
| 47 | + $model->message = App::$Security->secureHtml((string) App::$Request->request->get('message')); |
|
| 48 | 48 | $model->guestName = App::$Security->strip_tags(App::$Request->request->get('guest-name')); |
| 49 | 49 | |
| 50 | 50 | // check model conditions before add new row |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | // get configs |
| 77 | 77 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
| 78 | 78 | // items per page |
| 79 | - $perPage = (int)$configs['perPage']; |
|
| 79 | + $perPage = (int) $configs['perPage']; |
|
| 80 | 80 | // offset can be only integer |
| 81 | - $index = (int)$index; |
|
| 81 | + $index = (int) $index; |
|
| 82 | 82 | $offset = $perPage * $index; |
| 83 | 83 | // get comment target path and check |
| 84 | - $path = (string)App::$Request->query->get('path'); |
|
| 84 | + $path = (string) App::$Request->query->get('path'); |
|
| 85 | 85 | if (Str::likeEmpty($path)) { |
| 86 | 86 | throw new NotFoundException('Wrong path'); |
| 87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $query = CommentPost::where('pathway', '=', $path); |
| 91 | 91 | |
| 92 | 92 | // check if comments is depend of language locale |
| 93 | - if ((int)$configs['onlyLocale'] === 1) { |
|
| 93 | + if ((int) $configs['onlyLocale'] === 1) { |
|
| 94 | 94 | $query = $query->where('lang', '=', App::$Request->getLanguage()); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $this->setJsonHeader(); |
| 142 | 142 | // check input data |
| 143 | - if (!Obj::isLikeInt($commentId) || (int)$commentId < 1) { |
|
| 143 | + if (!Obj::isLikeInt($commentId) || (int) $commentId < 1) { |
|
| 144 | 144 | throw new ForbiddenException('Input data is incorrect'); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // get data from db by comment id |
| 151 | 151 | $records = CommentAnswer::where('comment_id', '=', $commentId); |
| 152 | - if ((int)$configs['onlyLocale'] === 1) { |
|
| 152 | + if ((int) $configs['onlyLocale'] === 1) { |
|
| 153 | 153 | $records = $records->where('lang', '=', App::$Request->getLanguage()); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | foreach ($path as $id => $uri) { |
| 194 | 194 | $query = CommentPost::where('pathway', '=', $uri); |
| 195 | 195 | // check if comments is depend of language locale |
| 196 | - if ((int)$configs['onlyLocale'] === 1) { |
|
| 196 | + if ((int) $configs['onlyLocale'] === 1) { |
|
| 197 | 197 | $query = $query->where('lang', '=', App::$Request->getLanguage()); |
| 198 | 198 | } |
| 199 | 199 | // set itemId => count |
| 200 | - $count[(int)$id] = $query->count(); |
|
| 200 | + $count[(int) $id] = $query->count(); |
|
| 201 | 201 | } |
| 202 | 202 | // render json response |
| 203 | 203 | return json_encode(['status' => 1, 'count' => $count]); |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | // @codingStandardsIgnoreFile |
| 7 | 7 | |
| 8 | 8 | use Codeception\Module\PhpBrowser; |
| 9 | -use Helper\Acceptance; |
|
| 10 | 9 | |
| 11 | 10 | trait WebGuyActions |
| 12 | 11 | { |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | // @codingStandardsIgnoreFile |
| 7 | 7 | |
| 8 | 8 | use Codeception\Module\PhpBrowser; |
| 9 | -use Helper\Acceptance; |
|
| 10 | 9 | |
| 11 | 10 | trait WebGuyActions |
| 12 | 11 | { |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | use _generated\WebGuyActions; |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Define custom actions here |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * Define custom actions here |
|
| 25 | + */ |
|
| 26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | use _generated\WebGuyActions; |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Define custom actions here |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * Define custom actions here |
|
| 25 | + */ |
|
| 26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | use _generated\WebGuyActions; |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Define custom actions here |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * Define custom actions here |
|
| 25 | + */ |
|
| 26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | use _generated\WebGuyActions; |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Define custom actions here |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * Define custom actions here |
|
| 25 | + */ |
|
| 26 | 26 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Make query to database |
| 81 | - * @return object |
|
| 81 | + * @return string |
|
| 82 | 82 | */ |
| 83 | 83 | private function makeQuery() |
| 84 | 84 | { |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | |
| 73 | 73 | // render view |
| 74 | 74 | return App::$View->render($this->tpl, [ |
| 75 | - 'records' => $query |
|
| 75 | + 'records' => $query |
|
| 76 | 76 | ]); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | // check cache is defined |
| 34 | 34 | if ($this->cache === null || !Obj::isLikeInt($this->cache)) { |
| 35 | - $this->cache = (int)$cfg['cache']; |
|
| 35 | + $this->cache = (int) $cfg['cache']; |
|
| 36 | 36 | } |
| 37 | 37 | // check item count is defined |
| 38 | 38 | if ($this->count === null || !Obj::isLikeInt($this->count)) { |
| 39 | - $this->count = (int)$cfg['count']; |
|
| 39 | + $this->count = (int) $cfg['count']; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | $query = $this->makeQuery(); |
| 57 | 57 | } else { |
| 58 | 58 | // try get query result from cache |
| 59 | - $query = App::$Cache->get('widget.newcontent.' . $cacheHash); |
|
| 59 | + $query = App::$Cache->get('widget.newcontent.'.$cacheHash); |
|
| 60 | 60 | if ($query === null) { |
| 61 | 61 | // if query is not cached make it |
| 62 | 62 | $query = $this->makeQuery(); |
| 63 | 63 | // and save result to cache |
| 64 | - App::$Cache->set('widget.newcontent.' . $cacheHash, $query, $this->cache); |
|
| 64 | + App::$Cache->set('widget.newcontent.'.$cacheHash, $query, $this->cache); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * Set default values from configs |
|
| 29 | - */ |
|
| 28 | + * Set default values from configs |
|
| 29 | + */ |
|
| 30 | 30 | public function before() |
| 31 | 31 | { |
| 32 | 32 | $this->categories = Serialize::decode($this->_configs['categories']); |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Labels for form |
|
| 39 | - */ |
|
| 38 | + * Labels for form |
|
| 39 | + */ |
|
| 40 | 40 | public function labels() |
| 41 | 41 | { |
| 42 | 42 | return [ |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Validation rules |
|
| 51 | - */ |
|
| 50 | + * Validation rules |
|
| 51 | + */ |
|
| 52 | 52 | public function rules() |
| 53 | 53 | { |
| 54 | 54 | return [ |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | public function before() |
| 31 | 31 | { |
| 32 | 32 | $this->categories = Serialize::decode($this->_configs['categories']); |
| 33 | - $this->count = (int)$this->_configs['count']; |
|
| 34 | - $this->cache = (int)$this->_configs['cache']; |
|
| 33 | + $this->count = (int) $this->_configs['count']; |
|
| 34 | + $this->cache = (int) $this->_configs['cache']; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | public function getResult() |
| 65 | 65 | { |
| 66 | 66 | return [ |
| 67 | - 'count' => (int)$this->count, |
|
| 68 | - 'cache' => (int)$this->cache, |
|
| 67 | + 'count' => (int) $this->count, |
|
| 68 | + 'cache' => (int) $this->cache, |
|
| 69 | 69 | 'categories' => Serialize::encode($this->categories) |
| 70 | 70 | ]; |
| 71 | 71 | } |