@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | |
4 | 4 | use Core\Model; |
5 | 5 | |
6 | -class CategoryModel extends Model{ |
|
6 | +class CategoryModel extends Model { |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * get the list of categories and return all the data |
10 | 10 | * @return array the categories |
11 | 11 | * @throws \ReflectionException |
12 | 12 | */ |
13 | - public function getCategories(){ |
|
13 | + public function getCategories() { |
|
14 | 14 | return $this->getResultSet('categories'); |
15 | 15 | } |
16 | 16 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $categories = $this->getCategories(); |
27 | 27 | foreach ($categories as $category) { |
28 | 28 | $data += [ |
29 | - $category->category_name => '/category/posts/' . $category->categories_slug |
|
29 | + $category->category_name => '/category/posts/'.$category->categories_slug |
|
30 | 30 | ]; |
31 | 31 | } |
32 | 32 | return $data; |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | if (!$this->isAlphaNum($table)) { |
24 | - throw new \ErrorException("Invalid table name " . $table); |
|
24 | + throw new \ErrorException("Invalid table name ".$table); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | if (!$this->isAlphaNum($columnName)) { |
28 | - throw new \ErrorException("Invalid Column name " . $columnName); |
|
28 | + throw new \ErrorException("Invalid Column name ".$columnName); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $slugTbl = $this->getTablePrefix($table); |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | public function getIdFromSlug(string $slug, string $table, string $columnName, string $idColumn): int |
50 | 50 | { |
51 | 51 | if (!$this->isAlphaNum($table)) { |
52 | - throw new \ErrorException("Invalid table name " . $table); |
|
52 | + throw new \ErrorException("Invalid table name ".$table); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!$this->isAlphaNum($columnName)) { |
56 | - throw new \ErrorException("Invalid Slug Column name " . $columnName); |
|
56 | + throw new \ErrorException("Invalid Slug Column name ".$columnName); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if (!$this->isAlphaNum($idColumn)) { |
60 | - throw new \ErrorException("Invalid ID Column name " . $columnName); |
|
60 | + throw new \ErrorException("Invalid ID Column name ".$columnName); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $slugTbl = $this->getTablePrefix($table); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $trimed .= $string[$wordCounter]; |
93 | 93 | if ($wordCounter < $count - 1) { |
94 | 94 | $trimed .= " "; |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | $trimed .= "..."; |
97 | 97 | } |
98 | 98 | } |