Passed
Pull Request — 1.0.0-dev (#4)
by nguereza
13:14
created
core/classes/Config.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -160,15 +160,15 @@
 block discarded – undo
160 160
         }
161 161
          
162 162
         /**
163
-        * Return the server port using variable
164
-        *
165
-        * @codeCoverageIgnore
166
-        * @return string
167
-        */
163
+         * Return the server port using variable
164
+         *
165
+         * @codeCoverageIgnore
166
+         * @return string
167
+         */
168 168
         protected static function getServerPort() {
169 169
             $serverPort = 80;
170 170
             if (isset($_SERVER['SERVER_PORT'])) {
171
-                 $serverPort = $_SERVER['SERVER_PORT'];
171
+                    $serverPort = $_SERVER['SERVER_PORT'];
172 172
             }
173 173
             $port = '';
174 174
             if ((is_https() && $serverPort != 443) || (!is_https() && $serverPort != 80)) {
Please login to merge, or discard this patch.
core/libraries/Email.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             }
283 283
             $filename = $this->encodeUtf8($this->filterOther((string) $filename));
284 284
             if (empty($data)) {
285
-               $data = $this->getAttachmentData($path);
285
+                $data = $this->getAttachmentData($path);
286 286
             }
287 287
             $this->_attachments[] = array(
288 288
                 'path' => $path,
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $addresses = array();
347 347
             foreach ($pairs as $name => $email) {
348 348
                 if (is_numeric($name)) {
349
-                   $name = null;
349
+                    $name = null;
350 350
                 }
351 351
                 $addresses[] = $this->formatHeader($email, $name);
352 352
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
      */
46 46
 
47 47
     
48
-    class Email extends BaseClass{
48
+    class Email extends BaseClass {
49 49
         /**
50 50
          * @var int $_wrap
51 51
          */
Please login to merge, or discard this patch.
core/classes/Module.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         public function add($name) {
67 67
             $logger = self::getLogger();
68 68
             if (in_array($name, self::$list)) {
69
-               $logger->info('The module [' .$name. '] already added skipping.');
69
+               $logger->info('The module [' . $name . '] already added skipping.');
70 70
                return $this;
71 71
             }
72 72
             self::$list[] = $name;
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $logger->debug('Check if the application contains the modules ...');
41 41
             $dirList = glob(MODULE_PATH . '*', GLOB_ONLYDIR);
42 42
             if ($dirList !== false) {
43
-               self::$list = array_map('basename', $dirList);
43
+                self::$list = array_map('basename', $dirList);
44 44
             }
45 45
             if (!empty(self::$list)) {
46 46
                 $logger->info('The application contains the module below [' . implode(', ', self::getModuleList()) . ']');
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
         public function add($name) {
58 58
             $logger = self::getLogger();
59 59
             if (in_array($name, self::$list)) {
60
-               $logger->info('The module [' .$name. '] already added skipping.');
61
-               return $this;
60
+                $logger->info('The module [' .$name. '] already added skipping.');
61
+                return $this;
62 62
             }
63 63
             self::$list[] = $name;
64 64
             return $this;
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
             self::$list = array();
89 89
         }
90 90
 
91
-         /**
92
-         * Get the list of module loaded
93
-         * @return array the module list
94
-         */
91
+            /**
92
+             * Get the list of module loaded
93
+             * @return array the module list
94
+             */
95 95
         public static function getModuleList() {
96 96
             return self::$list;
97 97
         }
Please login to merge, or discard this patch.
app/config/autoload.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -25,103 +25,103 @@
 block discarded – undo
25 25
      */
26 26
 
27 27
     /**
28
-	* This file contains the configuration of resources that you want to load automatically: 
29
-	* personals or systems libraries, configuration files, models, languages
30
-	* personals functions or systems that are used often in your application 
31
-	* instead of loading them every time you want to use it.
32
-	* Note: loading a lot of resources can decrease the performance of your application.
33
-	*/
28
+     * This file contains the configuration of resources that you want to load automatically: 
29
+     * personals or systems libraries, configuration files, models, languages
30
+     * personals functions or systems that are used often in your application 
31
+     * instead of loading them every time you want to use it.
32
+     * Note: loading a lot of resources can decrease the performance of your application.
33
+     */
34 34
 
35 35
 
36
-	/**
37
-	* If you have personals libraries or systems to load automatically, then list them in the following array.
38
-	* For example :
39
-	*
40
-	*	$autoload['libraries'] = array('library1', 'library2');
41
-	*
42
-	* Using module:
43
-	* 
44
-	*   $autoload['libraries'] = array('module1/library1', 'module2/library1');
45
-	*
46
-	* Note: Systems libraries have priority over personals libraries, 
47
-	* ie the loading order is as follows: it looks in the folder of the systems libraries, 
48
-	* if it is found, it is loaded, if not, it search in the module directories, if it is found, 
49
-	* it is loaded, if not will search in personals libraries folder, 
50
-	* before returning an error in case it does not find it.
51
-	*/
36
+    /**
37
+     * If you have personals libraries or systems to load automatically, then list them in the following array.
38
+     * For example :
39
+     *
40
+     *	$autoload['libraries'] = array('library1', 'library2');
41
+     *
42
+     * Using module:
43
+     * 
44
+     *   $autoload['libraries'] = array('module1/library1', 'module2/library1');
45
+     *
46
+     * Note: Systems libraries have priority over personals libraries, 
47
+     * ie the loading order is as follows: it looks in the folder of the systems libraries, 
48
+     * if it is found, it is loaded, if not, it search in the module directories, if it is found, 
49
+     * it is loaded, if not will search in personals libraries folder, 
50
+     * before returning an error in case it does not find it.
51
+     */
52 52
     $autoload['libraries'] = array();
53 53
 
54 54
     /**
55
-	* If you have configuration files to load automatically, then list them in the following array.
56
-	* For example :
57
-	*
58
-	*	$autoload['config'] = array('config1', 'config2');
59
-	*
60
-	* Using module:
61
-	* 
62
-	*   $autoload['config'] = array('module1/config1', 'module2/config2');
63
-	*
64
-	* Note 1: the file name must have as prefix "config_" for config file inside CONFIG_PATH folder
65
-	* for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config,
66
-	* otherwise the system can not find this configuration file.
67
-	* For example :
68
-	*
69
-	*	$config['key1'] = value1;
70
-	* 	$config['key2'] = value2;
71
-	*
72
-	* Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php".
73
-	* or inside the "config" of your application modules
74
-	*/
55
+     * If you have configuration files to load automatically, then list them in the following array.
56
+     * For example :
57
+     *
58
+     *	$autoload['config'] = array('config1', 'config2');
59
+     *
60
+     * Using module:
61
+     * 
62
+     *   $autoload['config'] = array('module1/config1', 'module2/config2');
63
+     *
64
+     * Note 1: the file name must have as prefix "config_" for config file inside CONFIG_PATH folder
65
+     * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config,
66
+     * otherwise the system can not find this configuration file.
67
+     * For example :
68
+     *
69
+     *	$config['key1'] = value1;
70
+     * 	$config['key2'] = value2;
71
+     *
72
+     * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php".
73
+     * or inside the "config" of your application modules
74
+     */
75 75
     $autoload['config'] = array();
76 76
 
77 77
     /**
78
-	* If you have models to load automatically, then list them in the following array.
79
-	* For example :
80
-	*
81
-	*	$autoload['models'] = array('model1', 'model2');
82
-	*
83
-	* Using module:
84
-	* 
85
-	*   $autoload['models'] = array('module1/model1', 'module2/model2');
86
-	*/
78
+     * If you have models to load automatically, then list them in the following array.
79
+     * For example :
80
+     *
81
+     *	$autoload['models'] = array('model1', 'model2');
82
+     *
83
+     * Using module:
84
+     * 
85
+     *   $autoload['models'] = array('module1/model1', 'module2/model2');
86
+     */
87 87
     $autoload['models'] = array();
88 88
 
89 89
     /**
90
-	* If you have systems or personals functions to load automatically, specify them in the following array.
91
-	* For example :
92
-	*
93
-	* 	$autoload['functions'] = array('function1', 'function2');
94
-	*
95
-	* Using module:
96
-	* 
97
-	*   $autoload['functions'] = array('module1/function1', 'module2/function2');
98
-	*
99
-	* Note 1: Personal functions have priority over system functions,
100
-	* that is to say that the order of loading is the following : it looks in the directory of the modules functions, 
101
-	* if it is found, it is loaded, otherwise, it looks in the directory of the personal functions,
102
-	* if it is found, it is loaded, otherwise, it looks in the directory of the system functions,
103
-	* before returning an error in case he does not find it.
104
-	*
105
-	* Note 2: the file name must have as prefix "function_" for example "function_foo.php" then
106
-	* will use:
107
-	* 
108
-	*  $autoload['functions'] = array('foo');
109
-	*/
90
+     * If you have systems or personals functions to load automatically, specify them in the following array.
91
+     * For example :
92
+     *
93
+     * 	$autoload['functions'] = array('function1', 'function2');
94
+     *
95
+     * Using module:
96
+     * 
97
+     *   $autoload['functions'] = array('module1/function1', 'module2/function2');
98
+     *
99
+     * Note 1: Personal functions have priority over system functions,
100
+     * that is to say that the order of loading is the following : it looks in the directory of the modules functions, 
101
+     * if it is found, it is loaded, otherwise, it looks in the directory of the personal functions,
102
+     * if it is found, it is loaded, otherwise, it looks in the directory of the system functions,
103
+     * before returning an error in case he does not find it.
104
+     *
105
+     * Note 2: the file name must have as prefix "function_" for example "function_foo.php" then
106
+     * will use:
107
+     * 
108
+     *  $autoload['functions'] = array('foo');
109
+     */
110 110
     $autoload['functions'] = array();
111 111
 	
112 112
     /**
113
-	* If you have systems or personals languages to load automatically, specify them in the following array.
114
-	* For example :
115
-	*
116
-	* 	$autoload['languages'] = array('lang1', 'lang2');
117
-	*
118
-	* Using module:
119
-	* 
120
-	*   $autoload['languages'] = array('module1/lang1', 'module2/lang2');
121
-	*
122
-	* Note: the file name must have as prefix "lang_" for example "lang_foo.php" then
123
-	* will use:
124
-	* 
125
-	*  $autoload['languages'] = array('foo');
126
-	*/
113
+     * If you have systems or personals languages to load automatically, specify them in the following array.
114
+     * For example :
115
+     *
116
+     * 	$autoload['languages'] = array('lang1', 'lang2');
117
+     *
118
+     * Using module:
119
+     * 
120
+     *   $autoload['languages'] = array('module1/lang1', 'module2/lang2');
121
+     *
122
+     * Note: the file name must have as prefix "lang_" for example "lang_foo.php" then
123
+     * will use:
124
+     * 
125
+     *  $autoload['languages'] = array('foo');
126
+     */
127 127
     $autoload['languages'] = array();
Please login to merge, or discard this patch.
app/views/home.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
             <p>Author : <b><?php echo TNH_AUTHOR; ?></b></p>
35 35
             <p>Author E-mail : <b><?php echo TNH_AUTHOR_EMAIL; ?></b></p>
36 36
             <hr />
37
-            <p>Current controller: <b class = "text-muted label-danger"><?php echo APPS_CONTROLLER_PATH . 'Home.php';?></b>
38
-            <p>Current view: <b class = "text-muted label-danger"><?php echo APPS_VIEWS_PATH . 'home.php';?></b>
37
+            <p>Current controller: <b class = "text-muted label-danger"><?php echo APPS_CONTROLLER_PATH . 'Home.php'; ?></b>
38
+            <p>Current view: <b class = "text-muted label-danger"><?php echo APPS_VIEWS_PATH . 'home.php'; ?></b>
39 39
           </div>
40 40
         </div>
41 41
       </div>
Please login to merge, or discard this patch.
core/classes/Url.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
          * @return string the final path after add suffix if configured
143 143
          * otherwise the same value will be returned
144 144
          */
145
-        protected static function addSuffixInPath($path){
145
+        protected static function addSuffixInPath($path) {
146 146
             $suffix = get_config('url_suffix');
147 147
             if ($suffix && $path) {
148 148
                 if (strpos($path, '?') !== false) {
Please login to merge, or discard this patch.
core/classes/Request.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -262,24 +262,24 @@
 block discarded – undo
262 262
             return $this;
263 263
         }
264 264
 
265
-         /**
266
-         * Return the instance of session.
267
-         * @return object the session instance
268
-         */
265
+            /**
266
+             * Return the instance of session.
267
+             * @return object the session instance
268
+             */
269 269
         public function getSession() {
270 270
             return $this->session;
271 271
         }
272 272
 
273
-         /**
274
-         * Set the value for $_GET, $_POST, $_SERVER etc. if the key is an array will
275
-         * set the current super variable value by this.
276
-         * @param string $type the type can be "post", "get", etc.
277
-         * @param  string|array  $key the item key to be set or array if need set the current global variable 
278
-         * by this value
279
-         * @param mixed $value the value to set if $key is not an array
280
-         *
281
-         * @return object       the current instance
282
-         */
273
+            /**
274
+             * Set the value for $_GET, $_POST, $_SERVER etc. if the key is an array will
275
+             * set the current super variable value by this.
276
+             * @param string $type the type can be "post", "get", etc.
277
+             * @param  string|array  $key the item key to be set or array if need set the current global variable 
278
+             * by this value
279
+             * @param mixed $value the value to set if $key is not an array
280
+             *
281
+             * @return object       the current instance
282
+             */
283 283
         protected function setVars($type, $key, $value = null) {
284 284
             if (is_array($key)) {
285 285
                 //set all
Please login to merge, or discard this patch.
core/classes/Response.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
          * 
347 347
          * @return string|null          the full file path
348 348
          */
349
-        protected static function getDefaultFilePathForView($file){
349
+        protected static function getDefaultFilePathForView($file) {
350 350
             $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH);
351 351
             $fullFilePath = null;
352 352
             foreach ($searchDir as $dir) {
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
             // Parse out the elapsed time and memory usage,
466 466
             // then swap the pseudo-variables with the data
467 467
             $elapsedTime = $benchmark->elapsedTime('APP_EXECUTION_START', 'APP_EXECUTION_END');
468
-            $memoryUsage    = round($benchmark->memoryUsage('APP_EXECUTION_START', 'APP_EXECUTION_END') / 1024 / 1024, 6) . 'MB';
468
+            $memoryUsage = round($benchmark->memoryUsage('APP_EXECUTION_START', 'APP_EXECUTION_END') / 1024 / 1024, 6) . 'MB';
469 469
             return str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsedTime, $memoryUsage), $content); 
470 470
         }
471 471
 
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             } else {
186 186
                 $logger->info('Cannot find view [' . $view . '] in module [' . $module . '] using the default location');
187 187
             }
188
-			if (!$path) {
188
+            if (!$path) {
189 189
                 $path = $this->getDefaultFilePathForView($viewFile);
190 190
             }
191 191
             $logger->info('The view file path to be loaded is [' . $path . ']');
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
             return $this->_pageRender;
274 274
         }
275 275
 
276
-         /**
277
-         * Set the final page to be rendered
278
-         * @param string $finalPage the content of the final page
279
-         * 
280
-         * @return object
281
-         */
276
+            /**
277
+             * Set the final page to be rendered
278
+             * @param string $finalPage the content of the final page
279
+             * 
280
+             * @return object
281
+             */
282 282
         public function setFinalPageContent($finalPage) {
283 283
             $this->_pageRender = $finalPage;
284 284
             return $this;
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
             ob_end_flush();
352 352
         }
353 353
 
354
-         /**
355
-         * Return the default full file path for view
356
-         * @param  string $file    the filename
357
-         * 
358
-         * @return string|null          the full file path
359
-         */
354
+            /**
355
+             * Return the default full file path for view
356
+             * @param  string $file    the filename
357
+             * 
358
+             * @return string|null          the full file path
359
+             */
360 360
         protected static function getDefaultFilePathForView($file){
361 361
             $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH);
362 362
             $fullFilePath = null;
@@ -548,18 +548,18 @@  discard block
 block discarded – undo
548 548
             }
549 549
         }
550 550
 
551
-         /**
552
-         * Set the mandory headers, like security, etc.
553
-         */
551
+            /**
552
+             * Set the mandory headers, like security, etc.
553
+             */
554 554
         protected static function setRequiredHeaders() {
555 555
             $requiredHeaders = array(
556 556
                                 'X-XSS-Protection' => '1; mode=block',
557 557
                                 'X-Frame-Options'  => 'SAMEORIGIN'
558 558
                             );
559 559
             foreach ($requiredHeaders as $key => $value) {
560
-               if (!isset(self::$headers[$key])) {
560
+                if (!isset(self::$headers[$key])) {
561 561
                     self::$headers[$key] = $value;
562
-               } 
562
+                } 
563 563
             }
564 564
         }
565 565
     }
Please login to merge, or discard this patch.
core/classes/Router.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
         }
242 242
 
243 243
         /**
244
-        * Setting the route configuration using the configuration file and additional configuration from param
245
-        * @param array $overwriteConfig the additional configuration to overwrite with the existing one
246
-        * @param boolean $useConfigFile whether to use route configuration file
247
-        * 
248
-        * @return object
249
-        */
244
+         * Setting the route configuration using the configuration file and additional configuration from param
245
+         * @param array $overwriteConfig the additional configuration to overwrite with the existing one
246
+         * @param boolean $useConfigFile whether to use route configuration file
247
+         * 
248
+         * @return object
249
+         */
250 250
         public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) {
251 251
             $route = array();
252 252
             if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) {
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
             }
424 424
         }
425 425
 
426
-         /**
427
-         * Remove the URL suffix and query string values if exists
428
-         * @param  string $uri the route URI to process
429
-         * @return string      the final route uri after processed
430
-         */
426
+            /**
427
+             * Remove the URL suffix and query string values if exists
428
+             * @param  string $uri the route URI to process
429
+             * @return string      the final route uri after processed
430
+             */
431 431
         protected function removeSuffixAndQueryStringFromUri($uri) {
432 432
             $this->logger->debug('Check if URL suffix is enabled in the configuration');
433 433
             //remove url suffix from the request URI
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                 $this->logger->info(
541 541
                                     'After loop in predefined routes configuration,'
542 542
                                     . 'the module name is set but the controller is not set,' 
543
-									. 'so we will use module as the controller'
543
+                                    . 'so we will use module as the controller'
544 544
                                 );
545 545
                 $this->controller = $this->module;
546 546
             }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
          * Remove the DOCUMENT_ROOT and front controller from segments if exists
408 408
          * @return void
409 409
          */
410
-        protected function removeDocumentRootFrontControllerFromSegments(){
410
+        protected function removeDocumentRootFrontControllerFromSegments() {
411 411
             $segment = $this->segments;
412 412
             $baseUrl = get_config('base_url');
413 413
             //check if the app is not in DOCUMENT_ROOT
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                     break;
526 526
                 }
527 527
             }
528
-            if($findIndex !== -1){
528
+            if ($findIndex !== -1) {
529 529
                 //$args[0] => full string captured by preg_match
530 530
                 //$args[1], $args[2], $args[n] => contains the value of 
531 531
                 //(:num), (:alpha), (:alnum), (:any)
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
          * Find file path of the current controller using the current module
551 551
          * @return boolean true if the file path is found otherwise false.
552 552
          */
553
-        protected function findControllerFullPathUsingCurrentModule(){
553
+        protected function findControllerFullPathUsingCurrentModule() {
554 554
             $path = Module::findControllerFullPath(ucfirst($this->controller), $this->module);
555 555
             if (!$path) {
556 556
                 $this->logger->info('The controller [' . $this->controller . '] not found in the module, may be will use the module [' . $this->module . '] as controller');
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
          * or the current request does not use module
567 567
          * @return void
568 568
          */
569
-        protected function setRouteParamsIfNoModuleOrNotFound(){
569
+        protected function setRouteParamsIfNoModuleOrNotFound() {
570 570
             $segment = $this->segments;
571 571
             //controller
572 572
             if (isset($segment[0])) {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
          * or the current request use module
588 588
          * @return void
589 589
          */
590
-        protected function setRouteParamsIfAppHasModuleOrFound(){
590
+        protected function setRouteParamsIfAppHasModuleOrFound() {
591 591
             //get the module list
592 592
             $modules = Module::getModuleList();
593 593
             $segment = $this->segments;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
                     $this->controller = $segment[0];
601 601
 
602 602
                     //check if the request use the same module name and controller
603
-                    if($this->findControllerFullPathUsingCurrentModule()){
603
+                    if ($this->findControllerFullPathUsingCurrentModule()) {
604 604
                         array_shift($segment);
605 605
                     }
606 606
                 }
Please login to merge, or discard this patch.