Test Failed
Push — 1.0.0-dev ( cd4ca0...fa3079 )
by nguereza
02:36
created
core/bootstrap.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
     defined('ROOT_PATH') || exit('Access denied');
3
-     /**
4
-     * TNH Framework
5
-     *
6
-     * A simple PHP framework using HMVC architecture
7
-     *
8
-     * This content is released under the MIT License (MIT)
9
-     *
10
-     * Copyright (c) 2017 TNH Framework
11
-     *
12
-     * Permission is hereby granted, free of charge, to any person obtaining a copy
13
-     * of this software and associated documentation files (the "Software"), to deal
14
-     * in the Software without restriction, including without limitation the rights
15
-     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
-     * copies of the Software, and to permit persons to whom the Software is
17
-     * furnished to do so, subject to the following conditions:
18
-     *
19
-     * The above copyright notice and this permission notice shall be included in all
20
-     * copies or substantial portions of the Software.
21
-     *
22
-     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
-     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
-     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
-     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
-     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
-     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
-     * SOFTWARE.
29
-     */
3
+        /**
4
+         * TNH Framework
5
+         *
6
+         * A simple PHP framework using HMVC architecture
7
+         *
8
+         * This content is released under the MIT License (MIT)
9
+         *
10
+         * Copyright (c) 2017 TNH Framework
11
+         *
12
+         * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+         * of this software and associated documentation files (the "Software"), to deal
14
+         * in the Software without restriction, including without limitation the rights
15
+         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+         * copies of the Software, and to permit persons to whom the Software is
17
+         * furnished to do so, subject to the following conditions:
18
+         *
19
+         * The above copyright notice and this permission notice shall be included in all
20
+         * copies or substantial portions of the Software.
21
+         *
22
+         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+         * SOFTWARE.
29
+         */
30 30
 
31 31
     /**
32 32
      *  @file bootstrap.php
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     /**
144 144
      * Register controllers autoload function
145 145
      */
146
-     spl_autoload_register('autoload_controller');
146
+        spl_autoload_register('autoload_controller');
147 147
 
148 148
     /**
149 149
      * Loading Security class
Please login to merge, or discard this patch.
core/classes/database/DatabaseConnection.php 2 patches
Indentation   +39 added lines, -40 removed lines patch added patch discarded remove patch
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
          */
43 43
         private $driver = null;
44 44
 
45
-         /**
46
-         * The database hostname
47
-         * @var string
48
-         */
45
+            /**
46
+             * The database hostname
47
+             * @var string
48
+             */
49 49
         private $hostname = null;
50 50
 
51
-          /**
52
-         * The database port
53
-         * @var integer
54
-         */
51
+            /**
52
+             * The database port
53
+             * @var integer
54
+             */
55 55
         private $port = null;
56 56
         
57
-         /**
58
-         * The database username
59
-         * @var string
60
-         */
57
+            /**
58
+             * The database username
59
+             * @var string
60
+             */
61 61
         private $username = null;
62 62
 
63
-         /**
64
-         * The database password
65
-         * @var string
66
-         */
63
+            /**
64
+             * The database password
65
+             * @var string
66
+             */
67 67
         private $password = null;
68 68
 
69 69
         /**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
          */
73 73
         private $databaseName = null;
74 74
 
75
-         /**
76
-         * The database charset
77
-         * @var string
78
-         */
75
+            /**
76
+             * The database charset
77
+             * @var string
78
+             */
79 79
         private $charset = null;
80 80
 
81 81
         /**
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
          */
85 85
         private $collation = null;
86 86
 
87
-         /**
88
-         * The database tables prefix
89
-         * @var string
90
-         */
87
+            /**
88
+             * The database tables prefix
89
+             * @var string
90
+             */
91 91
         private $prefix = null;
92 92
 
93 93
         /**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
             }
115 115
         }
116 116
 
117
-         /**
118
-         * This is method is used to connect to database
119
-         * 
120
-         * @return boolean true in case of successfully connection false if error
121
-         */
117
+            /**
118
+             * This is method is used to connect to database
119
+             * 
120
+             * @return boolean true in case of successfully connection false if error
121
+             */
122 122
         public function connect() {
123 123
             try {
124 124
                 $options = array(
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
             $this->populatePropertiesFromConfig();
415 415
 
416 416
             if (!empty($this->config)) {
417
-               //For logging
417
+                //For logging
418 418
                 $configInfo = $this->config;
419 419
                 //Hide password from log
420 420
                 $configInfo['password'] = string_hidden($this->getPassword());
@@ -423,11 +423,10 @@  discard block
 block discarded – undo
423 423
             return $this;
424 424
         }
425 425
 
426
-         /**
427
-         * Get the database configuration using the configuration file
428
-         
429
-         * @return array the database configuration from file
430
-         */
426
+            /**
427
+             * Get the database configuration using the configuration file
428
+             * @return array the database configuration from file
429
+             */
431 430
         public function getDatabaseConfigFromFile() {
432 431
             $db = array();
433 432
             if (file_exists(CONFIG_PATH . 'database.php')) {
@@ -437,11 +436,11 @@  discard block
 block discarded – undo
437 436
             return $db;
438 437
         }
439 438
 
440
-         /**
441
-         * Update the properties using the current database configuration
442
-         * 
443
-         * @return object the current instance
444
-         */
439
+            /**
440
+             * Update the properties using the current database configuration
441
+             * 
442
+             * @return object the current instance
443
+             */
445 444
         protected function populatePropertiesFromConfig() {
446 445
             foreach ($this->config as $key => $value) {
447 446
                 $setter = 'set' . ucfirst($key);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
                     PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ
126 126
                 );
127 127
                 $this->pdo = new PDO($this->getDsnValue(), $this->getUsername(), $this->getPassword(), $options);
128
-                if($this->getDriver() == 'mysql') {
128
+                if ($this->getDriver() == 'mysql') {
129 129
                     $this->pdo->exec("SET NAMES '" . $this->getCharset() . "' COLLATE '" . $this->getCollation() . "'");
130 130
                     $this->pdo->exec("SET CHARACTER SET '" . $this->getCharset() . "'");
131 131
                 }
Please login to merge, or discard this patch.
core/classes/database/Database.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
          */
112 112
         public function __construct(DatabaseConnection $connection = null) {
113 113
             parent::__construct();
114
-    		if ($connection !== null) {
114
+            if ($connection !== null) {
115 115
                 $this->connection = $connection;
116 116
             } 
117 117
         }
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
                 $this->queryCount++;
386 386
                 
387 387
                 $queryResult = $this->queryRunner->setQuery($query)
388
-                                                 ->setReturnType($returnAsList)
389
-                                                 ->setReturnAsArray($returnAsArray)
390
-                                                 ->execute();
388
+                                                    ->setReturnType($returnAsList)
389
+                                                    ->setReturnAsArray($returnAsArray)
390
+                                                    ->execute();
391 391
 
392 392
                 if (is_object($queryResult)) {
393 393
                     $this->result  = $queryResult->getResult();
Please login to merge, or discard this patch.
core/classes/Response.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 $this->logger->info('Cannot find view [' . $view . '] in module [' . $module . '] '
191 191
                                     . 'using the default location');
192 192
             }
193
-			if (!$path) {
193
+            if (!$path) {
194 194
                 $path = $this->getDefaultFilePathForView($viewFile);
195 195
             }
196 196
             $this->logger->info('The view file path to be loaded is [' . $path . ']');
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
             return $this->finalPageContent;
267 267
         }
268 268
 
269
-         /**
270
-         * Set the final page to be rendered
271
-         * @param string $finalPage the content of the final page
272
-         * 
273
-         * @return object
274
-         */
269
+            /**
270
+             * Set the final page to be rendered
271
+             * @param string $finalPage the content of the final page
272
+             * 
273
+             * @return object
274
+             */
275 275
         public function setFinalPageContent($finalPage) {
276 276
             $this->finalPageContent = $finalPage;
277 277
             return $this;
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
         }
346 346
 
347 347
                 /**
348
-         * Dispatch the FINAL_VIEW_READY event
349
-         *             
350
-         * @return string|null the final view content after processing by each listener
351
-         * if they exists otherwise the same content will be returned
352
-         */
348
+                 * Dispatch the FINAL_VIEW_READY event
349
+                 *             
350
+                 * @return string|null the final view content after processing by each listener
351
+                 * if they exists otherwise the same content will be returned
352
+                 */
353 353
         protected function dispatchFinalViewEvent() {
354 354
             //dispatch
355 355
             $event = get_instance()->eventdispatcher->dispatch(
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
         }
384 384
 
385 385
 
386
-         /**
387
-         * Return the default full file path for view
388
-         * @param  string $file    the filename
389
-         * 
390
-         * @return string|null          the full file path
391
-         */
386
+            /**
387
+             * Return the default full file path for view
388
+             * @param  string $file    the filename
389
+             * 
390
+             * @return string|null          the full file path
391
+             */
392 392
         protected function getDefaultFilePathForView($file){
393 393
             $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH);
394 394
             $fullFilePath = null;
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                 $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE');
422 422
                 if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) {
423 423
                     $this->logger->info('The cache page content is not yet expire for the '
424
-                                         . 'URL [' . $this->currentUrl . '] send 304 header to browser');
424
+                                            . 'URL [' . $this->currentUrl . '] send 304 header to browser');
425 425
                     $this->sendHeaders(304);
426 426
                     return true;
427 427
                 }
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
          */
437 437
         protected function sendCachePageContentToBrowser(&$cache) {
438 438
             $this->logger->info('The cache page content is expired or the browser does '
439
-                 . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] '
440
-                 . 'send cache headers to tell the browser');
439
+                    . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] '
440
+                    . 'send cache headers to tell the browser');
441 441
             $this->sendHeaders(200);
442 442
             //current page cache key
443 443
             $pageCacheKey = $this->currentUrlCacheKey;
@@ -576,18 +576,18 @@  discard block
 block discarded – undo
576 576
             }
577 577
         }
578 578
 
579
-         /**
580
-         * Set the mandory headers, like security, etc.
581
-         */
579
+            /**
580
+             * Set the mandory headers, like security, etc.
581
+             */
582 582
         protected function setRequiredHeaders() {
583 583
             $requiredHeaders = array(
584 584
                                 'X-XSS-Protection' => '1; mode=block',
585 585
                                 'X-Frame-Options'  => 'SAMEORIGIN'
586 586
                             );
587 587
             foreach ($requiredHeaders as $key => $value) {
588
-               if (!isset($this->headers[$key])) {
588
+                if (!isset($this->headers[$key])) {
589 589
                     $this->headers[$key] = $value;
590
-               } 
590
+                } 
591 591
             }
592 592
         }
593 593
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             $cacheInfo = $cache->getInfo($pageCacheKey);
250 250
             if ($cacheInfo) {
251 251
                 $status = $this->sendCacheNotYetExpireInfoToBrowser($cacheInfo);
252
-                if($status === false) {
252
+                if ($status === false) {
253 253
                     return $this->sendCachePageContentToBrowser($cache);
254 254
                 }
255 255
                 return true;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
          */
324 324
         public function sendError(array $data = array()) {
325 325
             $path = CORE_VIEWS_PATH . 'errors.php';
326
-            if(file_exists($path)){
326
+            if (file_exists($path)) {
327 327
                 //compress the output if is available
328 328
                 $compressOutputHandler = $this->getCompressOutputHandler();
329 329
                 ob_start($compressOutputHandler);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 echo $content;
336 336
             }
337 337
             //@codeCoverageIgnoreStart
338
-            else{
338
+            else {
339 339
                 //can't use show_error() at this time because 
340 340
                 //some dependencies not yet loaded
341 341
                 set_http_status_header(503);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
          * 
390 390
          * @return string|null          the full file path
391 391
          */
392
-        protected function getDefaultFilePathForView($file){
392
+        protected function getDefaultFilePathForView($file) {
393 393
             $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH);
394 394
             $fullFilePath = null;
395 395
             foreach ($searchDir as $dir) {
Please login to merge, or discard this patch.
core/classes/EventDispatcher.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
                 return;
157 157
             } 
158 158
             $this->logger->info('Found the registered event listener for the '
159
-                                 . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list));
159
+                                    . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list));
160 160
             foreach ($list as $listener) {
161 161
                 $result = call_user_func_array($listener, array($event));
162 162
                 if ($eBackup->returnBack === true) {
Please login to merge, or discard this patch.
core/libraries/FormValidation.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
             }
134 134
         }
135 135
 
136
-         /**
137
-         * Reset the form validation instance
138
-         *
139
-         * @return object the current instance
140
-         */
136
+            /**
137
+             * Reset the form validation instance
138
+             *
139
+             * @return object the current instance
140
+             */
141 141
         public function reset() {
142 142
             $this->rules        = array();
143 143
             $this->labels       = array();
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
             return $this;
162 162
         }
163 163
 
164
-         /**
165
-         * Return the validation data
166
-         * 
167
-         * @return array the validation data
168
-         */
164
+            /**
165
+             * Return the validation data
166
+             * 
167
+             * @return array the validation data
168
+             */
169 169
         public function getData() {
170 170
             return $this->data;
171 171
         }
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
             return $this->rules;
215 215
         }
216 216
 
217
-         /**
218
-         * Return the list of the validations rules for the given field
219
-         * 
220
-         * @return array
221
-         */
217
+            /**
218
+             * Return the list of the validations rules for the given field
219
+             * 
220
+             * @return array
221
+             */
222 222
         public function getFieldRules($field) {
223 223
             $rules = array();
224 224
             if (array_key_exists($field, $this->rules)) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
          * @return string|null
235 235
          */
236 236
         public function getFieldValue($field) {
237
-             $value = null;
237
+                $value = null;
238 238
             if (array_key_exists($field, $this->data)) {
239 239
                 $value = $this->data[$field];
240 240
             }
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
         }
257 257
             
258 258
         
259
-       /**
260
-        * Return the list of validation errors
261
-        * 
262
-        * @return array the errors list. 
263
-        * Format:
264
-        *  [field1] => 'error message 1', 
265
-        *  [field2] => 'error message 2' 
266
-        */
267
-       public function getErrors() {
259
+        /**
260
+         * Return the list of validation errors
261
+         * 
262
+         * @return array the errors list. 
263
+         * Format:
264
+         *  [field1] => 'error message 1', 
265
+         *  [field2] => 'error message 2' 
266
+         */
267
+        public function getErrors() {
268 268
             return $this->errors;
269 269
         }
270 270
 
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
             return $this;
348 348
         }
349 349
 
350
-         /**
351
-         * Set the database instance using get_instance() if is null
352
-         *
353
-         * @return object the current instance
354
-         */
350
+            /**
351
+             * Set the database instance using get_instance() if is null
352
+             *
353
+             * @return object the current instance
354
+             */
355 355
         protected function setDatabaseFromSuperInstanceIfNotSet() {
356 356
             if (!is_object($this->database)) {
357 357
                 $this->database = get_instance()->database;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
          * @param string|null $field2     the second field used in some validation rule like "matches", "not_equal"
389 389
          *
390 390
          */
391
-         protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) {
391
+            protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) {
392 392
             //if the field is not required and his value is not set don't set error
393 393
             //but in case the field have value validate it
394 394
             if (!$this->fieldIsRequired($field) && strlen($value) <= 0) {
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
          * @return string       the name of the validation method
415 415
          */
416 416
         protected function getRuleValidationMethod($rule) {
417
-             $parts = explode('_', $rule);
418
-             $parts = array_map('ucfirst', $parts);
419
-             return 'checkRule' . implode('', $parts);
417
+                $parts = explode('_', $rule);
418
+                $parts = array_map('ucfirst', $parts);
419
+                return 'checkRule' . implode('', $parts);
420 420
         }
421 421
         
422 422
         /**
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         protected function filterValidationData() {
428 428
             foreach ($this->data as $key => $value ) {
429 429
                 if (is_string($value)) {
430
-                   $this->data[$key] = trim($value);
430
+                    $this->data[$key] = trim($value);
431 431
                 } else if(is_array($value)) {
432 432
                     $this->data[$key] = array_map('trim', $value);
433 433
                 }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 $template['field2}']  = $field2;
475 475
                 $template['{value2}'] = $this->getFieldValue($field2);
476 476
                 $template['{label2}'] = $this->getFieldLabel($field2);
477
-             }     
477
+                }     
478 478
             $message = $this->messages[$rule];
479 479
             //Check for custom message
480 480
             if (isset($this->customErrors[$field][$rule])) {
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
                 //Get the name of the method to validate this rule
506 506
                 $method = $this->getRuleValidationMethod($realRuleName);
507 507
                 if (method_exists($this, $method)) {
508
-                       call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue));
508
+                        call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue));
509 509
                 } else {
510 510
                     $this->forceError = true;
511 511
                     show_error('Invalid validaton rule "' . $realRuleName . '"');
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
          * @param  string|null  $paramValue  the rule parameter
598 598
          */ 
599 599
         protected function checkRuleMinLength($field, $rule, $paramValue) {
600
-           $value = $this->getFieldValue($field);    
600
+            $value = $this->getFieldValue($field);    
601 601
             if (strlen($value) < $paramValue) {
602 602
                 $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
603 603
             }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
          * @param  string|null  $paramValue  the rule parameter
612 612
          */
613 613
         protected function checkRuleMaxLength($field, $rule, $paramValue) {
614
-           $value = $this->getFieldValue($field);    
614
+            $value = $this->getFieldValue($field);    
615 615
             if (strlen($value) > $paramValue) {
616 616
                 $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
617 617
             }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
          * @param  string|null  $paramValue  the rule parameter
626 626
          */
627 627
         protected function checkRuleExactLength($field, $rule, $paramValue) {
628
-           $value = $this->getFieldValue($field);    
628
+            $value = $this->getFieldValue($field);    
629 629
             if (strlen($value) != $paramValue) {
630 630
                 $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
631 631
             }
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
         protected function checkRuleNumeric($field, $rule, $paramValue) {
733 733
             $value = $this->getFieldValue($field);    
734 734
             if (!is_numeric($value)) {
735
-               $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
735
+                $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
736 736
             }
737 737
         }
738 738
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
         protected function checkRuleInteger($field, $rule, $paramValue) {
747 747
             $value = $this->getFieldValue($field);    
748 748
             if (filter_var($value, FILTER_VALIDATE_INT) === false) {
749
-               $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
749
+                $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
750 750
             }
751 751
         }
752 752
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
         protected function checkRuleIntegerNatural($field, $rule, $paramValue) {
761 761
             $value = $this->getFieldValue($field);    
762 762
             if (filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0) {
763
-               $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
763
+                $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
764 764
             }
765 765
         }
766 766
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
             $format = $paramValue;
848 848
             $dateValue = date_create_from_format($format, $value);    
849 849
             if ($dateValue === false || $dateValue->format($format) !== $value) {
850
-               $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
850
+                $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
851 851
             }
852 852
         }
853 853
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
         protected function checkRuleUrl($field, $rule, $paramValue) {
892 892
             $value = $this->getFieldValue($field);    
893 893
             if (filter_var($value, FILTER_VALIDATE_URL) === false) {
894
-               $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
894
+                $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
895 895
             }
896 896
         }
897 897
 
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
         protected function checkRuleIp($field, $rule, $paramValue) {
907 907
             $value = $this->getFieldValue($field);    
908 908
             if (filter_var($value, FILTER_VALIDATE_IP) === false) {
909
-               $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
909
+                $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
910 910
             }
911 911
         }
912 912
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
             $value = $this->getFieldValue($field);    
952 952
             list($table, $column) = explode('.', $paramValue);
953 953
             $this->database->getQueryBuilder()->from($table)
954
-                                              ->where($column, $value);
954
+                                                ->where($column, $value);
955 955
             $this->database->get();
956 956
             if ($this->database->numRows() > 0) {
957 957
                 $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
             list($table, $column) = explode('.', $data[0]);
974 974
             list($columnKey, $valueKey) = explode('=', $data[1]);
975 975
             $this->database->getQueryBuilder()->from($table)
976
-                                              ->where($column, $value)
977
-                                              ->where($columnKey, '!=', trim($valueKey));
976
+                                                ->where($column, $value)
977
+                                                ->where($columnKey, '!=', trim($valueKey));
978 978
             $this->database->get();
979 979
             if ($this->database->numRows() > 0) {
980 980
                 $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
             $value = $this->getFieldValue($field);    
995 995
             list($table, $column) = explode('.', $paramValue);
996 996
             $this->database->getQueryBuilder()->from($table)
997
-                                              ->where($column, $value);
997
+                                                ->where($column, $value);
998 998
             $this->database->get();
999 999
             if ($this->database->numRows() <= 0) {
1000 1000
                 $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
          * @return object the current instance
426 426
          */
427 427
         protected function filterValidationData() {
428
-            foreach ($this->data as $key => $value ) {
428
+            foreach ($this->data as $key => $value) {
429 429
                 if (is_string($value)) {
430 430
                    $this->data[$key] = trim($value);
431
-                } else if(is_array($value)) {
431
+                } else if (is_array($value)) {
432 432
                     $this->data[$key] = array_map('trim', $value);
433 433
                 }
434 434
             }
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
                 if (call_user_func_array($paramValue, array($value)) === false) {
1038 1038
                     $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue);
1039 1039
                 }
1040
-            } else{
1040
+            } else {
1041 1041
                 $this->forceError = true;
1042 1042
                 show_error('The callback validation function/method "' . $paramValue . '" does not exist');
1043 1043
             }
Please login to merge, or discard this patch.
core/classes/cache/FileCache.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -108,13 +108,13 @@
 block discarded – undo
108 108
         public function set($key, $data, $ttl = 0) {
109 109
             $expire = time() + $ttl;
110 110
             $this->logger->debug('Setting cache data for key [' . $key . '], '
111
-                           . 'time to live [' . $ttl . '], '
112
-                           . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']');
111
+                            . 'time to live [' . $ttl . '], '
112
+                            . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']');
113 113
             $filePath = $this->getFilePath($key);
114 114
             $handle = fopen($filePath, 'w');
115 115
             if (!is_resource($handle)) {
116 116
                 $this->logger->error('Can not open the file cache '
117
-                                     . '[' . $filePath . '] for the key [' . $key . '], return false');
117
+                                        . '[' . $filePath . '] for the key [' . $key . '], return false');
118 118
                 return false;
119 119
             }
120 120
             flock($handle, LOCK_EX); // exclusive lock, will get released when the file is closed
Please login to merge, or discard this patch.
core/classes/Log.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@
 block discarded – undo
214 214
         protected function getLogDebugBacktraceInfo() {
215 215
             $dtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
216 216
             $i = 0;
217
-            while ($dtrace[$i]['file'] == __FILE__ ) {
217
+            while ($dtrace[$i]['file'] == __FILE__) {
218 218
                 $i++;
219 219
             } 
220 220
             $fileInfo = $dtrace[$i];
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $this->log(self::DEBUG, $message);
170 170
         } 
171 171
 		
172
-		/**
172
+        /**
173 173
          * Logs with an arbitrary level.
174 174
          *
175 175
          * @param  integer|string $level   the log level in integer or string format,
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
                 //NOTE: here need put the show_error() "logging" to false 
188 188
                 //to prevent self function loop call
189 189
                 show_error('Invalid config log level [' . $configLogLevel . '], '
190
-                           . 'the value must be one of the following: ' 
191
-                           . implode(', ', array_map('strtoupper', self::$validConfigLevel))
192
-                           , 'Log Config Error', 
193
-                           $logging = false
194
-                       );
190
+                            . 'the value must be one of the following: ' 
191
+                            . implode(', ', array_map('strtoupper', self::$validConfigLevel))
192
+                            , 'Log Config Error', 
193
+                            $logging = false
194
+                        );
195 195
                 return;	
196 196
             }
197 197
 			
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         protected function levelCanSaveLog($level) {
262 262
             $result = true;
263 263
             $configLogLevel = get_config('log_level');
264
-             //check if can save log regarding the log level configuration
264
+                //check if can save log regarding the log level configuration
265 265
             $configLevel = self::getLevelValue($configLogLevel);
266 266
             if ($configLevel > $level) {
267 267
                 //can't log
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                 //NOTE: here need put the show_error() "logging" to false 
342 342
                 //to prevent self function loop call
343 343
                 show_error('Error : the log dir does not exist or is not writable',
344
-                           'Log directory error', $logging = false);
344
+                            'Log directory error', $logging = false);
345 345
             }
346 346
 			
347 347
             $path = $logSavePath . 'logs-' . date('Y-m-d') . '.log';
Please login to merge, or discard this patch.
core/classes/Router.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
         }
278 278
 
279 279
         /**
280
-        * Setting the route configuration using the configuration file 
281
-        * and additional configuration from param
282
-        * @param array $overwriteConfig the additional configuration 
283
-        * to overwrite with the existing one
284
-        * @param boolean $useConfigFile whether to use route configuration file
285
-        * 
286
-        * @return object
287
-        */
280
+         * Setting the route configuration using the configuration file 
281
+         * and additional configuration from param
282
+         * @param array $overwriteConfig the additional configuration 
283
+         * to overwrite with the existing one
284
+         * @param boolean $useConfigFile whether to use route configuration file
285
+         * 
286
+         * @return object
287
+         */
288 288
         public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) {
289 289
             $route = array();
290 290
             if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             //the URL like http://domain.com/module/controller/method/arg1/arg2
366 366
             if (!$this->controller) {
367 367
                 $this->logger->info('Cannot determine the routing information ' 
368
-                       . 'using the predefined routes configuration, will use the request URI parameters');
368
+                        . 'using the predefined routes configuration, will use the request URI parameters');
369 369
                 //determine route parameters using the route URI param
370 370
                 $this->determineRouteParamsFromRequestUri();
371 371
             }
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
             }
479 479
         }
480 480
 
481
-         /**
482
-         * Remove the URL suffix and query string values if exists
483
-         * @param  string $uri the route URI to process
484
-         * @return string      the final route uri after processed
485
-         */
481
+            /**
482
+             * Remove the URL suffix and query string values if exists
483
+             * @param  string $uri the route URI to process
484
+             * @return string      the final route uri after processed
485
+             */
486 486
         protected function removeSuffixAndQueryStringFromUri($uri) {
487 487
             $this->logger->debug('Check if URL suffix is enabled in the configuration');
488 488
             //remove url suffix from the request URI
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
                 $this->logger->info(
597 597
                                     'After loop in predefined routes configuration,'
598 598
                                     . 'the module name is set but the controller is not set,' 
599
-									. 'so we will use module as the controller'
599
+                                    . 'so we will use module as the controller'
600 600
                                 );
601 601
                 $this->controller = $this->module;
602 602
             }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
          * Remove the DOCUMENT_ROOT and front controller from segments if exists
451 451
          * @return void
452 452
          */
453
-        protected function removeDocumentRootFrontControllerFromSegments(){
453
+        protected function removeDocumentRootFrontControllerFromSegments() {
454 454
             $segment = $this->segments;
455 455
             $globals = & class_loader('GlobalVar', 'classes');
456 456
             $rootFolder = substr($globals->server('SCRIPT_NAME'), 0, strpos(
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                     break;
582 582
                 }
583 583
             }
584
-            if($findIndex !== -1){
584
+            if ($findIndex !== -1) {
585 585
                 //$args[0] => full string captured by preg_match
586 586
                 //$args[1], $args[2], $args[n] => contains the value of 
587 587
                 //(:num), (:alpha), (:alnum), (:any)
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
          * Find file path of the current controller using the current module
607 607
          * @return boolean true if the file path is found otherwise false.
608 608
          */
609
-        protected function findControllerFullPathUsingCurrentModule(){
609
+        protected function findControllerFullPathUsingCurrentModule() {
610 610
             $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module);
611 611
             if (!$path) {
612 612
                 $this->logger->info('The controller [' . $this->controller . '] not ' 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
          * or the current request does not use module
624 624
          * @return void
625 625
          */
626
-        protected function setRouteParamsIfNoModuleOrNotFound(){
626
+        protected function setRouteParamsIfNoModuleOrNotFound() {
627 627
             $segment = $this->segments;
628 628
             //controller
629 629
             if (isset($segment[0])) {
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
          * or the current request use module
645 645
          * @return void
646 646
          */
647
-        protected function setRouteParamsIfAppHasModuleOrFound(){
647
+        protected function setRouteParamsIfAppHasModuleOrFound() {
648 648
             //get the module list
649 649
             $modules = $this->moduleInstance->getModuleList();
650 650
             $segment = $this->segments;
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                     $this->controller = $segment[0];
658 658
 
659 659
                     //check if the request use the same module name and controller
660
-                    if($this->findControllerFullPathUsingCurrentModule()){
660
+                    if ($this->findControllerFullPathUsingCurrentModule()) {
661 661
                         array_shift($segment);
662 662
                     }
663 663
                 }
Please login to merge, or discard this patch.