Test Failed
Push — 1.0.0-dev ( 72449d...860cec )
by nguereza
02:46
created
core/libraries/Upload.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
          *
284 284
          * @return object the current instance
285 285
          */
286
-        public function setUploadedFileData(array $fileData){
286
+        public function setUploadedFileData(array $fileData) {
287 287
             $this->uploadedFileData = $fileData;
288 288
             return $this;
289 289
         }
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
          *    @return    boolean
527 527
          */
528 528
         public function isAllowOverwriting() {
529
-            return $this->overwriteFile ;
529
+            return $this->overwriteFile;
530 530
         }
531 531
 
532 532
         /**
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
          *    @return    string
566 566
          */
567 567
         public function getDestinationDirectory() {
568
-            return $this->destinationDirectory ;
568
+            return $this->destinationDirectory;
569 569
         }
570 570
 
571 571
         /**
Please login to merge, or discard this 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/DBSessionHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -318,7 +318,7 @@
 block discarded – undo
318 318
          * Get some parameters data need like ip address, hostname, browser info, etc.
319 319
          * @return array
320 320
          */
321
-        protected function getSessionDataParams(){
321
+        protected function getSessionDataParams() {
322 322
             $this->OBJ->loader->functions('user_agent'); 
323 323
             $this->OBJ->loader->library('Browser'); 
324 324
             
Please login to merge, or discard this patch.
core/libraries/Cookie.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@
 block discarded – undo
64 64
         public function set($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false) {
65 65
             if (headers_sent()) {
66 66
                 show_error('There exists a cookie that we wanted to create that we couldn\'t '
67
-						    . 'because headers was already sent. Make sure to do this first ' 
68
-							. 'before outputing anything.');
67
+                            . 'because headers was already sent. Make sure to do this first ' 
68
+                            . 'before outputing anything.');
69 69
             }
70 70
             $timestamp = $expire;
71 71
             if ($expire) {
Please login to merge, or discard this patch.
core/classes/Controller.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
          *
94 94
          * @codeCoverageIgnore
95 95
          */
96
-         private function startAppSession() {
96
+            private function startAppSession() {
97 97
             //$_SESSION is not available on cli mode 
98 98
             if (!IS_CLI) {
99 99
                 //set session params
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
          * @codeCoverageIgnore
144 144
          */
145 145
         private function setAppSessionConfig() {
146
-             //the default is to store in the files
146
+                //the default is to store in the files
147 147
             $sessionHandler = $this->config->get('session_handler', 'files');
148 148
             $this->logger->info('Session handler: ' . $sessionHandler);
149 149
             if ($sessionHandler == 'files') {
Please login to merge, or discard this patch.
core/classes/model/Model.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     class Model {
32 32
 
33
-       /**
33
+        /**
34 34
          * This model's default database table. 
35 35
          * @var string the name of table
36 36
          */
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
             if ($db !== null) {
174 174
                 $this->setDb($db);
175 175
             } else {
176
-                 /**
177
-                 * NOTE: Need use "clone" because some Model need have the personal instance of the database library
178
-                 * to prevent duplication
179
-                 */
180
-                 $obj = & get_instance();
181
-                 $this->setDb(clone $obj->database);
176
+                    /**
177
+                     * NOTE: Need use "clone" because some Model need have the personal instance of the database library
178
+                     * to prevent duplication
179
+                     */
180
+                    $obj = & get_instance();
181
+                    $this->setDb(clone $obj->database);
182 182
             }
183 183
             array_unshift($this->beforeCreateCallbacks, 'removeProtectedTableColumns');
184 184
             array_unshift($this->beforeUpdateCallbacks, 'removeProtectedTableColumns');
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
          * Only get deleted rows on the next call
624 624
          * 
625 625
          * @return object the current instance
626
-        */
626
+         */
627 627
         public function onlyRecordDeleted() {
628 628
             $this->returnOnlyRecordDeleted = true;
629 629
             return $this;
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
          * @return array the data after add field for updated time
650 650
          */
651 651
         public function updatedAt($row) {
652
-           $row['updated_at'] = date('Y-m-d H:i:s');
653
-           return $row;
652
+            $row['updated_at'] = date('Y-m-d H:i:s');
653
+            return $row;
654 654
         }
655 655
 
656 656
         /**
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
          */
696 696
         public function removeProtectedTableColumns($row) {
697 697
             foreach ($this->protectedTableColumns as $attr) {
698
-               if (isset($row[$attr])) {
698
+                if (isset($row[$attr])) {
699 699
                     unset($row[$attr]);
700 700
                 }
701 701
             }
@@ -818,23 +818,23 @@  discard block
 block discarded – undo
818 818
             return false;
819 819
         }
820 820
 
821
-         /**
822
-         * Get the record return type array or object
823
-         * 
824
-         * @return string|boolean
825
-         */
821
+            /**
822
+             * Get the record return type array or object
823
+             * 
824
+             * @return string|boolean
825
+             */
826 826
         protected function getReturnType(){
827 827
             $type = false;
828 828
             if ($this->temporaryReturnRecordType == 'array') {
829
-               $type = 'array';
829
+                $type = 'array';
830 830
             }
831 831
             return $type;
832 832
         }
833 833
 
834
-         /**
835
-         * Check if soft delete is enable setting the condition
836
-         * @return object the current instance 
837
-         */
834
+            /**
835
+             * Check if soft delete is enable setting the condition
836
+             * @return object the current instance 
837
+             */
838 838
         protected function checkForSoftDelete(){
839 839
             if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) {
840 840
                 $this->getQueryBuilder()->where(
@@ -845,16 +845,16 @@  discard block
 block discarded – undo
845 845
             return $this;
846 846
         }
847 847
 
848
-         /**
849
-         * Relate for "manyToOne" and "oneToMany"
850
-         * 
851
-         * @param  string $relationship the name of relation
852
-         * @param  string|array $options      the model and primary key values
853
-         * @param  object|array $row          the row to update
854
-         * @param  string $type the type can be "manyToOne", "oneToMany"
855
-         * 
856
-         * @return array|object the final row values
857
-         */
848
+            /**
849
+             * Relate for "manyToOne" and "oneToMany"
850
+             * 
851
+             * @param  string $relationship the name of relation
852
+             * @param  string|array $options      the model and primary key values
853
+             * @param  object|array $row          the row to update
854
+             * @param  string $type the type can be "manyToOne", "oneToMany"
855
+             * 
856
+             * @return array|object the final row values
857
+             */
858 858
         protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){
859 859
             if (in_array($relationship, $this->withs)) {
860 860
                 get_instance()->loader->model($options['model'], $relationship . '_model');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
          * 
824 824
          * @return string|boolean
825 825
          */
826
-        protected function getReturnType(){
826
+        protected function getReturnType() {
827 827
             $type = false;
828 828
             if ($this->temporaryReturnRecordType == 'array') {
829 829
                $type = 'array';
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
          * Check if soft delete is enable setting the condition
836 836
          * @return object the current instance 
837 837
          */
838
-        protected function checkForSoftDelete(){
838
+        protected function checkForSoftDelete() {
839 839
             if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) {
840 840
                 $this->getQueryBuilder()->where(
841 841
                                                 $this->softDeleteTableColumn, 
@@ -855,11 +855,11 @@  discard block
 block discarded – undo
855 855
          * 
856 856
          * @return array|object the final row values
857 857
          */
858
-        protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){
858
+        protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type) {
859 859
             if (in_array($relationship, $this->withs)) {
860 860
                 get_instance()->loader->model($options['model'], $relationship . '_model');
861 861
                 $model = get_instance()->{$relationship . '_model'};
862
-                if($type == 'manyToOne'){
862
+                if ($type == 'manyToOne') {
863 863
                     if (is_object($row)) {
864 864
                         $row->{$relationship} = $model->getSingleRecord($row->{$options['primary_key']});
865 865
                     } else {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
                 } else {
970 970
                     if (is_int($field)) {
971 971
                         //Condition like xxxx->getListRecordCond(array('id'));
972
-                        $this->getQueryBuilder()->where($value);  // WHERE id = ''
972
+                        $this->getQueryBuilder()->where($value); // WHERE id = ''
973 973
                     } else {
974 974
                         //Condition like xxxx->getListRecordCond(array('status' => 0));
975 975
                         $this->getQueryBuilder()->where($field, $value); // WHERE status = 0
Please login to merge, or discard this patch.
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/cache/ApcCache.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         /**
34 34
          * Construct new ApcCache instance
35 35
          */
36
-	public function __construct() {
36
+    public function __construct() {
37 37
             parent::__construct();
38 38
             if (!$this->isSupported()) {
39 39
                 show_error('The cache for APC[u] driver is not available. Check if APC[u] extension is loaded and enabled.');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         public function set($key, $data, $ttl = 0) {
80 80
             $expire = time() + $ttl;
81 81
             $this->logger->debug('Setting cache data for key [' . $key . '], time to live [' . $ttl . '], '
82
-                                 . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']');
82
+                                    . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']');
83 83
             $result = apc_store($key, $data, $ttl);
84 84
             if ($result === false) {
85 85
                 $this->logger->error('Can not save cache data for the key [' . $key . '], return false');
Please login to merge, or discard this patch.
core/classes/Log.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -140,11 +140,11 @@
 block discarded – undo
140 140
                 //NOTE: here need put the show_error() "logging" to false 
141 141
                 //to prevent self function loop call
142 142
                 show_error('Invalid config log level [' . $configLogLevel . '], '
143
-                           . 'the value must be one of the following: ' 
144
-                           . implode(', ', array_map('strtoupper', self::$validConfigLevel))
145
-                           , 'Log Config Error', 
146
-                           $logging = false
147
-                       );
143
+                            . 'the value must be one of the following: ' 
144
+                            . implode(', ', array_map('strtoupper', self::$validConfigLevel))
145
+                            , 'Log Config Error', 
146
+                            $logging = false
147
+                        );
148 148
                 return;	
149 149
             }
150 150
 			
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.