Passed
Push — Showing-Posts ( 7eacb0...555668 )
by Stone
03:19 queued 55s
created
Core/Dependency/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * get the current uri for routing
35 35
      * @return mixed
36 36
      */
37
-    public function getUri(){
37
+    public function getUri() {
38 38
         return $_SERVER['REQUEST_URI'];
39 39
     }
40 40
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $host = $_SERVER['HTTP_HOST'];
69 69
         $https = !empty($_SERVER['HTTPS']) ? 'https' : 'http';
70
-        return $https . '://' . $host . '/';
70
+        return $https.'://'.$host.'/';
71 71
     }
72 72
 
73 73
     /**
Please login to merge, or discard this patch.
App/Controllers/Admin/Update.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         }
37 37
         if ($success) {
38 38
             $this->alertBox->setAlert('Configuration updates successfully');
39
-        } else {
39
+        }else {
40 40
             $this->alertBox->setAlert('error in configuration update', 'error');
41 41
         }
42 42
         $this->container->getResponse()->redirect('admin/config');
Please login to merge, or discard this patch.
Core/Model.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * fetches the result from an executed query
102 102
      * @return array
103 103
      */
104
-    protected function fetchAll(){
104
+    protected function fetchAll() {
105 105
         return $this->stmt->fetchAll();
106 106
     }
107 107
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * returns a single line from the executed query
110 110
      * @return mixed
111 111
      */
112
-    protected function fetch(){
112
+    protected function fetch() {
113 113
         return $this->stmt->fetch();
114 114
     }
115 115
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $table = $reflect->getShortName(); //this is to only get the model name, otherwise we get the full namespace
137 137
             //since our models all end with Model, we should remove it.
138 138
             $table = $this->removeFromEnd($table, 'Model');
139
-            $table = $table . 's'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s
139
+            $table = $table.'s'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s
140 140
             $table = strtolower($table); //the database names are in lowercase
141 141
         }
142 142
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         }
156 156
 
157 157
         //if we are here, then table doesn't exist, check for view
158
-        $view = 'v_' . $table;
158
+        $view = 'v_'.$table;
159 159
         $stmt->bindValue(':table', $view, PDO::PARAM_STR);
160 160
         $stmt->execute();
161 161
         $exists = $stmt->rowCount() > 0; //will return 1 if table exists or 0 if non existant
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
      * @param $table string the table name
177 177
      * @return string
178 178
      */
179
-    protected function getTablePrefix($table){
180
-        if(Config::TABLE_PREFIX != '')
179
+    protected function getTablePrefix($table) {
180
+        if (Config::TABLE_PREFIX != '')
181 181
         {
182 182
             $table = Config::TABLE_PREFIX.'_'.$table;
183 183
         }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     protected function getRowById($rowId, $table = null): array
249 249
     {
250 250
         $tableName = $this->getTable($table);
251
-        $idName = 'id' . $tableName;
251
+        $idName = 'id'.$tableName;
252 252
         $sql = "SELECT * FROM $tableName WHERE $idName = :rowId";
253 253
         $this->query($sql);
254 254
         $this->bind(':rowId', $rowId);
Please login to merge, or discard this patch.
Core/Traits/StringFunctions.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@
 block discarded – undo
78 78
         $trimed = '';
79 79
         for ( $wordCounter = 0; $wordCounter < $count; $wordCounter++ ){
80 80
             $trimed .= $string[$wordCounter];
81
-            if ( $wordCounter < $count-1 ){ $trimed .= " "; }
82
-            else { $trimed .= "..."; }
81
+            if ( $wordCounter < $count-1 ){ $trimed .= " "; } else { $trimed .= "..."; }
83 82
         }
84 83
         $trimed = trim($trimed);
85 84
         return $trimed;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,20 +75,20 @@
 block discarded – undo
75 75
      * @return string the shortend text
76 76
      * @throws \ErrorException
77 77
      */
78
-    public function getExcerpt(string $text, int $count=Constant::EXCERPT_WORD_COUNT){
79
-        if($count < 1){
78
+    public function getExcerpt(string $text, int $count = Constant::EXCERPT_WORD_COUNT) {
79
+        if ($count < 1) {
80 80
             throw new \ErrorException('excerpt length too low');
81 81
         }
82 82
 
83 83
         $text = str_replace("  ", " ", $text);
84 84
         $string = explode(" ", $text);
85
-        if(count($string) <= $count){
85
+        if (count($string) <= $count) {
86 86
             return $text;
87 87
         }
88 88
         $trimed = '';
89
-        for ( $wordCounter = 0; $wordCounter < $count; $wordCounter++ ){
89
+        for ($wordCounter = 0; $wordCounter < $count; $wordCounter++) {
90 90
             $trimed .= $string[$wordCounter];
91
-            if ( $wordCounter < $count-1 ){ $trimed .= " "; }
91
+            if ($wordCounter < $count - 1) { $trimed .= " "; }
92 92
             else { $trimed .= "..."; }
93 93
         }
94 94
         $trimed = trim($trimed);
Please login to merge, or discard this patch.
Core/Constant.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,5 +22,5 @@
 block discarded – undo
22 22
     const FRONT_PAGE_POSTS = 3;
23 23
     const POSTS_PER_PAGE = 10;
24 24
 
25
-    const EXCERPT_WORD_COUNT =20;
25
+    const EXCERPT_WORD_COUNT = 20;
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
Core/AdminController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
         $this->data['userLevel'] = $this->auth->getUserLevel();
28 28
     }
29 29
 
30
-    protected function onlyAdmin(){
31
-        if(!$this->auth->isAdmin()){
30
+    protected function onlyAdmin() {
31
+        if (!$this->auth->isAdmin()) {
32 32
             $this->alertBox->setAlert("Only admins can access this", 'error');
33 33
             $this->container->getResponse()->redirect('/admin');
34 34
         }
Please login to merge, or discard this patch.
App/Controllers/Admin/Home.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function index()
10 10
     {
11
-        if(!$this->auth->isUser()){
11
+        if (!$this->auth->isUser()) {
12 12
             $this->alertBox->setAlert("You must be connected to acces the admin interface", 'warning');
13 13
             $this->container->getResponse()->redirect();
14 14
         }
Please login to merge, or discard this patch.
App/Models/CategoryModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
26 26
         $categories = $this->getCategories();
27 27
         foreach ($categories as $category) {
28 28
             $data += [
29
-                $category->category_name => '/category/' . $category->categories_slug
29
+                $category->category_name => '/category/'.$category->categories_slug
30 30
             ];
31 31
         }
32 32
         return $data;
Please login to merge, or discard this patch.
App/Controllers/Admin/Post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use App\Models\CategoryModel;
5 5
 use Core\AdminController;
6 6
 
7
-class Post extends AdminController{
7
+class Post extends AdminController {
8 8
 
9 9
     /**
10 10
      * page for new post
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * Shows the post to modify and update
29 29
      * @param $idPost
30 30
      */
31
-    public function modify($idPost){
31
+    public function modify($idPost) {
32 32
         $this->onlyAdmin();
33 33
 
34 34
     }
Please login to merge, or discard this patch.