Passed
Push — master ( 26a277...a1c19a )
by Laurent
02:14 queued 12s
created
programs/app.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2018 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__) . '/define.php';
25
-require_once dirname(__FILE__) . '/functions.php';
24
+require_once dirname(__FILE__).'/define.php';
25
+require_once dirname(__FILE__).'/functions.php';
26 26
 
27 27
 /**
28 28
  * Provides extensible functionalities to manage an application.
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         $this->addonPrefix = 'libapp';
50 50
         $this->addonName = 'libapp';
51 51
 
52
-        $this->classPrefix = $this->addonPrefix . '_';
53
-        $this->controllerTg = 'addon/' . $this->addonName . '/main';
52
+        $this->classPrefix = $this->addonPrefix.'_';
53
+        $this->controllerTg = 'addon/'.$this->addonName.'/main';
54 54
 
55 55
         $addon = bab_getAddonInfosInstance($this->addonName);
56 56
         $this->phpPath = $addon->getPhpPath();
57 57
         $this->recordSetPath = $this->phpPath;
58 58
         $this->ctrlPath = $this->phpPath;
59
-        $this->uiPath = $this->phpPath . 'ui/';
59
+        $this->uiPath = $this->phpPath.'ui/';
60 60
 
61 61
         $babDB = bab_getDB();
62 62
 
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
     {
77 77
         if (substr($class, 0, strlen($this->classPrefix)) === $this->classPrefix) {
78 78
             if (substr($class, -3) === 'Set') {
79
-                $file = strtolower(substr($class, strlen($this->classPrefix), -3)) . '.class.php';
80
-                if (file_exists($this->recordSetPath . $file)) {
81
-                    require $this->recordSetPath . $file;
79
+                $file = strtolower(substr($class, strlen($this->classPrefix), -3)).'.class.php';
80
+                if (file_exists($this->recordSetPath.$file)) {
81
+                    require $this->recordSetPath.$file;
82 82
                     return true;
83 83
                 }
84 84
             } else {
85
-                $file = strtolower(substr($class, strlen($this->classPrefix))) . '.class.php';
86
-                if (file_exists($this->recordSetPath . $file)) {
87
-                    require $this->recordSetPath . $file;
85
+                $file = strtolower(substr($class, strlen($this->classPrefix))).'.class.php';
86
+                if (file_exists($this->recordSetPath.$file)) {
87
+                    require $this->recordSetPath.$file;
88 88
                     return true;
89 89
                 }
90 90
             }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
             if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') {
196 196
                 $incl = $method;
197
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
197
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
198 198
 
199 199
 
200 200
                 $classname = $this->$classNameMethod();
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                                 // We need to revert to multilang fields before synchronizing.
217 217
                                 $set->useLang(false);
218 218
                             }
219
-                            $sql .= $mysqlbackend->setToSql($set) . "\n";
219
+                            $sql .= $mysqlbackend->setToSql($set)."\n";
220 220
                         }
221 221
                     }
222 222
                 }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
             if (substr($method, 0, strlen('include')) === 'include' && substr($method, -strlen('Set')) === 'Set') {
249 249
                 $incl = $method;
250
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
250
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
251 251
 
252 252
                 $classname = $this->$classNameMethod();
253 253
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
                             if (class_exists($classname) && method_exists($this, $call)) {
263 263
                                 $set = $this->$call();
264
-                                $sql .= $mysqlbackend->setToSql($set) . "\n";
264
+                                $sql .= $mysqlbackend->setToSql($set)."\n";
265 265
                             }
266 266
                         }
267 267
                     }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
     public function includeBase()
277 277
     {
278
-        require_once APP_PHP_PATH . 'base.class.php';
278
+        require_once APP_PHP_PATH.'base.class.php';
279 279
     }
280 280
 
281 281
     /**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      */
284 284
     public function includeRecordSet()
285 285
     {
286
-        require_once APP_SET_PATH . 'record.class.php';
286
+        require_once APP_SET_PATH.'record.class.php';
287 287
     }
288 288
 
289 289
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function includeTraceableRecordSet()
294 294
     {
295
-        require_once APP_SET_PATH . 'traceablerecord.class.php';
295
+        require_once APP_SET_PATH.'traceablerecord.class.php';
296 296
     }
297 297
 
298 298
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function includeLogSet()
310 310
     {
311
-        require_once APP_SET_PATH . 'log.class.php';
311
+        require_once APP_SET_PATH.'log.class.php';
312 312
     }
313 313
 
314 314
     /**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function LogSetClassName()
326 326
     {
327
-        return $this->LogClassName() . 'Set';
327
+        return $this->LogClassName().'Set';
328 328
     }
329 329
 
330 330
     /**
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function includeLinkSet()
348 348
     {
349
-        require_once APP_SET_PATH . 'link.class.php';
349
+        require_once APP_SET_PATH.'link.class.php';
350 350
     }
351 351
 
352 352
     /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function LinkSetClassName()
364 364
     {
365
-        return $this->LinkClassName() . 'Set';
365
+        return $this->LinkClassName().'Set';
366 366
     }
367 367
 
368 368
     /**
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      */
384 384
     public function includeCustomFieldSet()
385 385
     {
386
-        require_once APP_SET_PATH . 'customfield.class.php';
386
+        require_once APP_SET_PATH.'customfield.class.php';
387 387
     }
388 388
 
389 389
     /**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public function CustomFieldSetClassName()
401 401
     {
402
-        return $this->CustomFieldClassName() . 'Set';
402
+        return $this->CustomFieldClassName().'Set';
403 403
     }
404 404
 
405 405
     /**
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
      */
422 422
     public function includeCustomSectionSet()
423 423
     {
424
-        require_once APP_SET_PATH . 'traceablerecord.class.php';
425
-        require_once APP_SET_PATH . 'customsection.class.php';
424
+        require_once APP_SET_PATH.'traceablerecord.class.php';
425
+        require_once APP_SET_PATH.'customsection.class.php';
426 426
     }
427 427
 
428 428
     /**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
      */
439 439
     public function CustomSectionSetClassName()
440 440
     {
441
-        return $this->CustomSectionClassName() . 'Set';
441
+        return $this->CustomSectionClassName().'Set';
442 442
     }
443 443
 
444 444
     /**
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
      */
461 461
     public function includeTagSet()
462 462
     {
463
-        require_once APP_SET_PATH . 'tag.class.php';
463
+        require_once APP_SET_PATH.'tag.class.php';
464 464
     }
465 465
 
466 466
     /**
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      */
477 477
     public function TagSetClassName()
478 478
     {
479
-        return $this->TagClassName() . 'Set';
479
+        return $this->TagClassName().'Set';
480 480
     }
481 481
 
482 482
     /**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
             return null;
512 512
         }
513 513
         list($classname, $id) = $refParts;
514
-        $classSet = $classname . 'Set';
514
+        $classSet = $classname.'Set';
515 515
         $set = $this->$classSet();
516 516
         if (isset($set)) {
517 517
             return $set->get($id);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
     {
531 531
         $fullClassName = get_class($record);
532 532
         list(, $className) = explode('_', $fullClassName);
533
-        return $className . ':' . $record->id;
533
+        return $className.':'.$record->id;
534 534
     }
535 535
 
536 536
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
      */
558 558
     public function translate($str, $str_plurals = null, $number = null)
559 559
     {
560
-        require_once APP_PHP_PATH . 'functions.php';
560
+        require_once APP_PHP_PATH.'functions.php';
561 561
         $translation = $str;
562 562
         if ($translate = bab_functionality::get('Translate/Gettext')) {
563 563
             /* @var $translate Func_Translate_Gettext */
@@ -608,16 +608,16 @@  discard block
 block discarded – undo
608 608
      */
609 609
     public function mailTo($addr, $subject = null, $body = null)
610 610
     {
611
-        $mailTo = 'mailto:' . $addr;
611
+        $mailTo = 'mailto:'.$addr;
612 612
         $parameters = array();
613 613
         if (isset($subject)) {
614
-            $parameters[] = 'subject=' . $subject;
614
+            $parameters[] = 'subject='.$subject;
615 615
         }
616 616
         if (isset($body)) {
617
-            $parameters[] = 'body=' . $body;
617
+            $parameters[] = 'body='.$body;
618 618
         }
619 619
         if (!empty($parameters)) {
620
-            $mailTo .= '?' . implode('&', $parameters);
620
+            $mailTo .= '?'.implode('&', $parameters);
621 621
         }
622 622
 
623 623
         return $mailTo;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
         }
669 669
 
670 670
         $number = number_format($number, $decimals, ',', ' ');
671
-        return str_replace(' ', bab_nbsp(), $number . ' ' . $prefix . $unitSymbol);
671
+        return str_replace(' ', bab_nbsp(), $number.' '.$prefix.$unitSymbol);
672 672
     }
673 673
 
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
         }
689 689
 
690 690
         if (!isset($format)) {
691
-            $format = bab_registry::get('/' . $this->addonName . '/numberFormat', $PhoneNumber->getDefaultFormat());
691
+            $format = bab_registry::get('/'.$this->addonName.'/numberFormat', $PhoneNumber->getDefaultFormat());
692 692
         }
693 693
         $phoneNumberUtil = $PhoneNumber->PhoneNumberUtil();
694 694
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
      */
710 710
     public function includeController()
711 711
     {
712
-        require_once APP_PHP_PATH . '/controller.class.php';
712
+        require_once APP_PHP_PATH.'/controller.class.php';
713 713
     }
714 714
 
715 715
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
      */
719 719
     public function includeRecordController()
720 720
     {
721
-        require_once APP_CTRL_PATH . '/record.ctrl.php';
721
+        require_once APP_CTRL_PATH.'/record.ctrl.php';
722 722
     }
723 723
 
724 724
 
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      */
759 759
     public function includeUi()
760 760
     {
761
-        require_once APP_UI_PATH . 'ui.class.php';
761
+        require_once APP_UI_PATH.'ui.class.php';
762 762
     }
763 763
 
764 764
 
@@ -770,14 +770,14 @@  discard block
 block discarded – undo
770 770
     public function Ui()
771 771
     {
772 772
         $this->includeUi();
773
-        return bab_getInstance($this->classPrefix . 'Ui');//->setApp($this);
773
+        return bab_getInstance($this->classPrefix.'Ui'); //->setApp($this);
774 774
     }
775 775
 
776 776
 
777 777
 
778 778
     protected function includeAccess()
779 779
     {
780
-        require_once WORKSPACE_PHP_PATH . '/access.class.php';
780
+        require_once WORKSPACE_PHP_PATH.'/access.class.php';
781 781
     }
782 782
 
783 783
 
@@ -809,29 +809,29 @@  discard block
 block discarded – undo
809 809
 
810 810
             case substr($name, -strlen('SetClassName')) === 'SetClassName':
811 811
                 $setName = substr($name, 0, strlen($name) - strlen('ClassName'));
812
-                return $this->classPrefix . $setName;
812
+                return $this->classPrefix.$setName;
813 813
 
814 814
             case substr($name, -strlen('ClassName')) === 'ClassName':
815 815
                 $recordName = substr($name, 0, strlen($name) - strlen('ClassName'));
816
-                return $this->classPrefix . $recordName;
816
+                return $this->classPrefix.$recordName;
817 817
 
818 818
             case substr($name, 0, strlen('include')) === 'include' && substr($name, -strlen('Set')) === 'Set':
819 819
                 $fileNameBase = strtolower(substr(substr($name, 0, strlen($name) - strlen('Set')), strlen('include')));
820
-                require_once PHP_SET_PATH . $fileNameBase . '.class.php';
820
+                require_once PHP_SET_PATH.$fileNameBase.'.class.php';
821 821
                 return;
822 822
 
823 823
             case substr($name, -strlen('Set')) === 'Set':
824
-                $includeMethod = 'include' . $name;
824
+                $includeMethod = 'include'.$name;
825 825
                 $this->$includeMethod();
826
-                $setClassNameMethod = $name . 'ClassName';
826
+                $setClassNameMethod = $name.'ClassName';
827 827
                 $className = $this->$setClassNameMethod();
828 828
                 $set = new $className($this);
829 829
                 return $set;
830 830
 
831 831
                 //case method_exists($this, $name . 'Set'):
832 832
             default:
833
-                $setName = $name . 'Set';
834
-                $recordClassNameMethod = $name . 'ClassName';
833
+                $setName = $name.'Set';
834
+                $recordClassNameMethod = $name.'ClassName';
835 835
                 $recordClassName = $this->$recordClassNameMethod();
836 836
                 if (isset($arguments[0])) {
837 837
                     if ($arguments[0] instanceof $recordClassName) {
Please login to merge, or discard this patch.