@@ -225,13 +225,13 @@ |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | - * get the list of all the posts. |
|
| 229 | - * @param int $offset |
|
| 230 | - * @param array $select array of limiters [$key => $val] will convert to "where $key = $val" |
|
| 231 | - * @param int $limit |
|
| 232 | - * @return array |
|
| 233 | - * @throws \ErrorException |
|
| 234 | - */ |
|
| 228 | + * get the list of all the posts. |
|
| 229 | + * @param int $offset |
|
| 230 | + * @param array $select array of limiters [$key => $val] will convert to "where $key = $val" |
|
| 231 | + * @param int $limit |
|
| 232 | + * @return array |
|
| 233 | + * @throws \ErrorException |
|
| 234 | + */ |
|
| 235 | 235 | public function getPosts(int $offset = 0, array $select = [], int $limit = Constant::POSTS_PER_PAGE): array |
| 236 | 236 | { |
| 237 | 237 | return $this->getAllPublishedPosts($offset, $limit, false, $select); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->query($sql); |
| 114 | 114 | if ($select != null) { |
| 115 | 115 | foreach ($select as $col => $val) { |
| 116 | - $this->bind(":" . $col, $val); |
|
| 116 | + $this->bind(":".$col, $val); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | $this->bind(":limit", $limit); |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | * @return int number of posts |
| 131 | 131 | * @throws Exception |
| 132 | 132 | */ |
| 133 | - private function countNumberPosts(array $select = [], $published=true): int |
|
| 133 | + private function countNumberPosts(array $select = [], $published = true): int |
|
| 134 | 134 | { |
| 135 | 135 | $sql = "SELECT COUNT(*) FROM $this->postsTbl"; |
| 136 | 136 | if ($this->queryWithTags) { |
| 137 | 137 | $sql .= " LEFT JOIN $this->postTagTbl ON $this->postsTbl.idposts = $this->postTagTbl.post_idposts"; |
| 138 | 138 | } |
| 139 | - if($published) |
|
| 139 | + if ($published) |
|
| 140 | 140 | { |
| 141 | 141 | $sql .= " WHERE published = 1"; |
| 142 | 142 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $this->query($sql); |
| 152 | 152 | if ($select != null) { |
| 153 | 153 | foreach ($select as $col => $val) { |
| 154 | - $this->bind(":" . $col, $val); |
|
| 154 | + $this->bind(":".$col, $val); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | $this->execute(); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $this->execute(); |
| 336 | 336 | |
| 337 | - return (int)$this->dbh->lastInsertId(); |
|
| 337 | + return (int) $this->dbh->lastInsertId(); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |