@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | $sql .= " AND on_front_page = 1"; |
| 75 | 75 | } |
| 76 | 76 | //if we have a limiting parameter |
| 77 | - if($select != null) |
|
| 77 | + if ($select != null) |
|
| 78 | 78 | { |
| 79 | 79 | foreach ($select as $col => $val) |
| 80 | 80 | { |
| 81 | - if(!$this->isAlphaNum($col)){ |
|
| 81 | + if (!$this->isAlphaNum($col)) { |
|
| 82 | 82 | throw new Exception("Invalid column name"); |
| 83 | 83 | } |
| 84 | 84 | $sql .= " AND $col = :$col"; |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | $sql .= " ORDER BY $this->postsTbl.creation_date DESC"; |
| 88 | 88 | $sql .= " LIMIT :limit OFFSET :offset"; |
| 89 | 89 | $this->query($sql); |
| 90 | - if($select != null) |
|
| 90 | + if ($select != null) |
|
| 91 | 91 | { |
| 92 | 92 | foreach ($select as $col => $val) |
| 93 | 93 | { |
| 94 | - $this->bind(":".$col,$val); |
|
| 94 | + $this->bind(":".$col, $val); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | $this->bind(":limit", $limit); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @return int number of posts |
| 108 | 108 | * @throws Exception |
| 109 | 109 | */ |
| 110 | - private function numberPosts(array $select=[]): int |
|
| 110 | + private function numberPosts(array $select = []): int |
|
| 111 | 111 | { |
| 112 | 112 | $sql = " |
| 113 | 113 | SELECT COUNT(*) FROM $this->postsTbl |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $this->query($sql); |
| 126 | 126 | if ($select != null) { |
| 127 | 127 | foreach ($select as $col => $val) { |
| 128 | - $this->bind(":" . $col, $val); |
|
| 128 | + $this->bind(":".$col, $val); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | $this->execute(); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @return array |
| 197 | 197 | * @throws \ErrorException |
| 198 | 198 | */ |
| 199 | - public function getPosts(int $offset = 0, array $select=[], int $limit = Constant::POSTS_PER_PAGE): array |
|
| 199 | + public function getPosts(int $offset = 0, array $select = [], int $limit = Constant::POSTS_PER_PAGE): array |
|
| 200 | 200 | { |
| 201 | 201 | return $this->getAllPublishedPosts($offset, $limit, false, $select); |
| 202 | 202 | } |