Test Failed
Push — 1.0.0-dev ( ab615c...777905 )
by nguereza
02:26
created
core/classes/model/Model.php 1 patch
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.
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/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/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/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.
app/config/config.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -134,26 +134,26 @@  discard block
 block discarded – undo
134 134
 	*/
135 135
 	
136 136
     /** 
137
-    * The log level
138
-    *
139
-    * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
140
-    *
141
-    * 'OFF' or 'NONE' = do not save log
142
-    * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY)
143
-    * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY)
144
-    * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY)
145
-    * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY)
146
-    * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
147
-    * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
148
-    * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
149
-    * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
150
-    *
151
-    * The default value is NONE if the config value is: null, '', 0, false
152
-    * 
153
-    * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small
154
-    * time the log file size will increase very fast and will cost the application performance
155
-    * and also the filesystem usage of your server.
156
-    */
137
+     * The log level
138
+     *
139
+     * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
140
+     *
141
+     * 'OFF' or 'NONE' = do not save log
142
+     * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY)
143
+     * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY)
144
+     * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY)
145
+     * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY)
146
+     * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
147
+     * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
148
+     * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
149
+     * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
150
+     *
151
+     * The default value is NONE if the config value is: null, '', 0, false
152
+     * 
153
+     * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small
154
+     * time the log file size will increase very fast and will cost the application performance
155
+     * and also the filesystem usage of your server.
156
+     */
157 157
     $config['log_level'] = 'NONE';
158 158
 
159 159
 
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
     $config['log_logger_name'] = array();
181 181
 
182 182
     /**
183
-    * The logger name custom level to use for the log
184
-    * 
185
-    * If this config is set so means the logger level will be used to overwrite 
186
-    * the default log level configuration above. 
187
-    *
188
-    * Example:
189
-    * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); 
190
-    * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name
191
-    *  will be saved for WARNING message and above
192
-    *  Note: You can also use an regular expression for the logger name.
193
-    *  Example:
194
-    *  $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info');
195
-    *  So all logger name like "Class::Config", "Class::Cookie", etc. will be match
196
-    */  
183
+     * The logger name custom level to use for the log
184
+     * 
185
+     * If this config is set so means the logger level will be used to overwrite 
186
+     * the default log level configuration above. 
187
+     *
188
+     * Example:
189
+     * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); 
190
+     * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name
191
+     *  will be saved for WARNING message and above
192
+     *  Note: You can also use an regular expression for the logger name.
193
+     *  Example:
194
+     *  $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info');
195
+     *  So all logger name like "Class::Config", "Class::Cookie", etc. will be match
196
+     */  
197 197
     $config['log_logger_name_level'] = array();
198 198
 	
199 199
 	
Please login to merge, or discard this patch.
core/classes/cache/ApcCache.php 1 patch
Indentation   +3 added lines, -3 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');
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                             'mtime'  => $cacheInfos['creation_time'],
128 128
                             'expire' => $cacheInfos['creation_time'] + $cacheInfos['ttl'],
129 129
                             'ttl'    => $cacheInfos['ttl']
130
-                           );
130
+                            );
131 131
             } 
132 132
             $this->logger->info('This cache does not exists skipping');
133 133
             return false;
Please login to merge, or discard this patch.
core/classes/cache/FileCache.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -108,13 +108,13 @@  discard block
 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
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
             if ($data['expire'] > time()) {
192 192
                 $this->logger->info('This cache not yet expired return cache informations');
193 193
                 return array(
194
-                           'mtime' => $data['mtime'],
195
-                           'expire' => $data['expire'],
196
-                           'ttl' => $data['ttl']
197
-                         );
194
+                            'mtime' => $data['mtime'],
195
+                            'expire' => $data['expire'],
196
+                            'ttl' => $data['ttl']
197
+                            );
198 198
             }
199 199
             $this->logger->info('This cache already expired return false');
200 200
             return false;
Please login to merge, or discard this patch.
core/libraries/Assets.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
      */
45 45
     class Assets extends BaseClass {
46 46
 
47
-         /**
48
-         * Construct new instance
49
-         */
47
+            /**
48
+             * Construct new instance
49
+             */
50 50
         public function __construct() {
51 51
             parent::__construct();
52 52
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
          * @see Assets:link
96 96
          */
97 97
         public function css($path) {
98
-           return $this->link($path, 'css');
98
+            return $this->link($path, 'css');
99 99
         }
100 100
 
101 101
         /**
Please login to merge, or discard this patch.