Test Failed
Push — 1.0.0-dev ( 72449d...860cec )
by nguereza
02:46
created
core/libraries/Upload.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
             return $this;
278 278
         }
279 279
 
280
-         /**
281
-         *    Get the uploade file array
282
-         *    @return    array
283
-         */
280
+            /**
281
+             *    Get the uploade file array
282
+             *    @return    array
283
+             */
284 284
         public function getUploadedFileData() {
285 285
             return $this->uploadedFileData;
286 286
         }
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
             return $this;
321 321
         }
322 322
 
323
-         /**
324
-         *    Get the filename
325
-         *    @return    string
326
-         */
323
+            /**
324
+             *    Get the filename
325
+             *    @return    string
326
+             */
327 327
         public function getFilename() {
328 328
             return $this->filename;
329 329
         }
@@ -352,23 +352,23 @@  discard block
 block discarded – undo
352 352
             return $this;
353 353
         }
354 354
 
355
-         /**
356
-         *    Get the max file size
357
-         *    @return    double|int
358
-         */
355
+            /**
356
+             *    Get the max file size
357
+             *    @return    double|int
358
+             */
359 359
         public function getMaxFileSize() {
360 360
             return $this->maxFileSize;
361 361
         }
362 362
 
363
-         /**
364
-         *    Append a mime type to allowed mime types
365
-         *
366
-         *    @since     1.0
367
-         *    @version   1.0.1
368
-         *    @param     string      $mime
369
-         *    @return    object
370
-         *    @method    boolean     setAllowMimeType
371
-         */
363
+            /**
364
+             *    Append a mime type to allowed mime types
365
+             *
366
+             *    @since     1.0
367
+             *    @version   1.0.1
368
+             *    @param     string      $mime
369
+             *    @return    object
370
+             *    @method    boolean     setAllowMimeType
371
+             */
372 372
         public function setAllowMimeType($mime) {
373 373
             $this->allowedMimeTypes[] = strtolower($mime);
374 374
             $this->file['allowed_mime_types'][] = strtolower($mime); 
@@ -485,10 +485,10 @@  discard block
 block discarded – undo
485 485
             return $this;
486 486
         }
487 487
 
488
-         /**
489
-         *    Get the upload function name like "copy", "move_uploaded_file"
490
-         *    @return    string
491
-         */
488
+            /**
489
+             *    Get the upload function name like "copy", "move_uploaded_file"
490
+             *    @return    string
491
+             */
492 492
         public function getUploadFunction() {
493 493
             return $this->uploadFunction;
494 494
         }
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
             return $this;
507 507
         }
508 508
 
509
-         /**
510
-         *    Get the allow overwriting
511
-         *    @return    boolean
512
-         */
509
+            /**
510
+             *    Get the allow overwriting
511
+             *    @return    boolean
512
+             */
513 513
         public function isAllowOverwriting() {
514 514
             return $this->overwriteFile ;
515 515
         }
@@ -614,14 +614,14 @@  discard block
 block discarded – undo
614 614
             return $this->error;
615 615
         }
616 616
 
617
-         /**
618
-         *    Retrive status of upload
619
-         *
620
-         *    @since     1.0
621
-         *    @version   1.0
622
-         *    @return    boolean
623
-         *    @method    boolean    getStatus
624
-         */
617
+            /**
618
+             *    Retrive status of upload
619
+             *
620
+             *    @since     1.0
621
+             *    @version   1.0
622
+             *    @return    boolean
623
+             *    @method    boolean    getStatus
624
+             */
625 625
         public function getStatus() {
626 626
             return $this->file['status'];
627 627
         }
@@ -654,11 +654,11 @@  discard block
 block discarded – undo
654 654
                                 && is_file($file);
655 655
         }
656 656
 
657
-         /**
658
-         * Set the filename if is empty using the uploaded data information
659
-         *
660
-         * @return object the current instance
661
-         */
657
+            /**
658
+             * Set the filename if is empty using the uploaded data information
659
+             *
660
+             * @return object the current instance
661
+             */
662 662
         protected function setFilenameUsingUploadedData() {
663 663
             // set original filename if not have a new name
664 664
             if (empty($this->filename)) {
Please login to merge, or discard this patch.
core/classes/Module.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
          */
59 59
         public function add($name) {
60 60
             if (in_array($name, $this->list)) {
61
-               $this->logger->info('The module [' .$name. '] already added skipping.');
62
-               return $this;
61
+                $this->logger->info('The module [' .$name. '] already added skipping.');
62
+                return $this;
63 63
             }
64 64
             $this->list[] = $name;
65 65
             return $this;
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
             $this->list = array();
91 91
         }
92 92
 
93
-         /**
94
-         * Get the list of module loaded
95
-         * @return array the module list
96
-         */
93
+            /**
94
+             * Get the list of module loaded
95
+             * @return array the module list
96
+             */
97 97
         public function getModuleList() {
98 98
             return $this->list;
99 99
         }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             $this->logger->debug('Check if the application contains the modules ...');
241 241
             $dirList = glob(MODULE_PATH . '*', GLOB_ONLYDIR);
242 242
             if ($dirList !== false) {
243
-               $this->list = array_map('basename', $dirList);
243
+                $this->list = array_map('basename', $dirList);
244 244
             }
245 245
             if (!empty($this->list)) {
246 246
                 $this->logger->info('The application contains the module below [' . implode(', ', $this->list) . ']');
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             $filePath = MODULE_PATH . $module . DS . $type . DS . $classFile;
264 264
             if (file_exists($filePath)) {
265 265
                 $this->logger->info('Found class [' . $class . '] in module [' . $module . '] '
266
-                                     . 'for [' . $type . '] the file path is [' . $filePath . ']');
266
+                                        . 'for [' . $type . '] the file path is [' . $filePath . ']');
267 267
                 return $filePath;
268 268
             }
269 269
             $this->logger->info('Class [' . $class . '] does not exist in the module [' . $module . '] for [' . $type . ']');
Please login to merge, or discard this patch.
core/classes/Config.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
             if ($init) {
47 47
                 $this->init();
48 48
                 //@codeCoverageIgnoreStart
49
-                 if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) {
49
+                    if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) {
50 50
                     $this->logger->warning('You are in production environment, please set '
51
-                                           . 'log level to WARNING, ERROR, FATAL to increase the application performance');
51
+                                            . 'log level to WARNING, ERROR, FATAL to increase the application performance');
52 52
                 }
53 53
                 //@codeCoverageIgnoreEnd
54 54
             }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             if (empty($this->config['base_url'])) {
147 147
                 if (ENVIRONMENT == 'production') {
148 148
                     $this->logger->warning('Application base URL is not set or invalid, please'
149
-                                           . ' set application base URL to increase the application loading time');
149
+                                            . ' set application base URL to increase the application loading time');
150 150
                 }
151 151
                 $baseUrl = null;
152 152
                 $protocol = 'http';
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                                                                     );
171 171
                 } else {
172 172
                     $this->logger->warning('Can not determine the application '
173
-                                           . 'base URL automatically, use http://localhost as default');
173
+                                            . 'base URL automatically, use http://localhost as default');
174 174
                     $baseUrl = 'http://localhost/';
175 175
                 }
176 176
                 $this->config['base_url'] = $baseUrl;
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
         }
180 180
          
181 181
         /**
182
-        * Return the server port using variable
183
-        *
184
-        * @codeCoverageIgnore
185
-        * @return string
186
-        */
182
+         * Return the server port using variable
183
+         *
184
+         * @codeCoverageIgnore
185
+         * @return string
186
+         */
187 187
         protected function getServerPort() {
188 188
             $globals = & class_loader('GlobalVar', 'classes');
189 189
             $serverPortValue = $globals->server('SERVER_PORT');
190 190
             $serverPort = 80;
191 191
             if ($serverPortValue) {
192
-                 $serverPort = $serverPortValue;
192
+                    $serverPort = $serverPortValue;
193 193
             }
194 194
             $port = '';
195 195
             if ((is_https() && $serverPort != 443) || (!is_https() && $serverPort != 80)) {
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/Loader.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             $moduleConfigPath = get_instance()->module->findConfigFullPath($filename, $module);
221 221
             if ($moduleConfigPath) {
222 222
                 $this->logger->info('Found config [' . $filename . '] from module [' . $module . '], '
223
-                                  . 'the file path is [' . $moduleConfigPath . '] we will used it');
223
+                                    . 'the file path is [' . $moduleConfigPath . '] we will used it');
224 224
                 $configFilePath = $moduleConfigPath;
225 225
             } else {
226 226
                 $this->logger->info('Cannot find config [' . $filename . '] from modules using the default location');
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){
340 340
             $searchDir = null;
341 341
             if ($type == 'function') {
342
-               $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH);
342
+                $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH);
343 343
             }
344 344
             else if ($type == 'language') {
345 345
                 $searchDir = array(APP_LANG_PATH, CORE_LANG_PATH);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             $moduleLibraryPath = get_instance()->module->findLibraryFullPath($class, $module);
508 508
             if ($moduleLibraryPath) {
509 509
                 $this->logger->info('Found library [' . $class . '] from module [' . $module . '], the '
510
-                                   . 'file path is [' . $moduleLibraryPath . '] we will used it');
510
+                                    . 'file path is [' . $moduleLibraryPath . '] we will used it');
511 511
                 $libraryFilePath = $moduleLibraryPath;
512 512
             } else {
513 513
                 $this->logger->info('Cannot find library [' . $class . '] from modules using the default location');
Please login to merge, or discard this patch.