Passed
Push — master ( 6d84d5...ce946c )
by Stefan
06:16
created
core/DeviceConfig.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     protected function setSupportedEapMethods($eapArray) {
84 84
         $this->supportedEapMethods = $eapArray;
85
-        $this->loggerInstance->debug(4, "This device (" . __CLASS__ . ") supports the following EAP methods: ");
85
+        $this->loggerInstance->debug(4, "This device (".__CLASS__.") supports the following EAP methods: ");
86 86
         $this->loggerInstance->debug(4, $this->supportedEapMethods);
87 87
     }
88 88
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             throw new Exception("No EAP type available.");
128 128
         }
129 129
         $this->attributes = $this->getProfileAttributes($profile);
130
-        $this->deviceUUID = common\Entity::uuid('', 'CAT' . $profile->institution . "-" . $profile->identifier . "-" . $this->device_id);
130
+        $this->deviceUUID = common\Entity::uuid('', 'CAT'.$profile->institution."-".$profile->identifier."-".$this->device_id);
131 131
 
132 132
 
133 133
         // if we are instantiating a Silverbullet profile AND have been given
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
         // create temporary directory, its full path will be saved in $this->FPATH;
152 152
         $tempDir = \core\common\Entity::createTemporaryDirectory($purpose);
153 153
         $this->FPATH = $tempDir['dir'];
154
-        mkdir($tempDir['dir'] . '/tmp');
155
-        chdir($tempDir['dir'] . '/tmp');
154
+        mkdir($tempDir['dir'].'/tmp');
155
+        chdir($tempDir['dir'].'/tmp');
156 156
         $caList = [];
157 157
         $x509 = new \core\common\X509();
158 158
         if (isset($this->attributes['eap:ca_file'])) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         }
173 173
         if (isset($this->attributes['general:logo_file'])) {
174 174
             $this->loggerInstance->debug(5, "saving IDP logo\n");
175
-            $this->attributes['internal:logo_file'] = $this->saveLogoFile($this->attributes['general:logo_file'],'idp');
175
+            $this->attributes['internal:logo_file'] = $this->saveLogoFile($this->attributes['general:logo_file'], 'idp');
176 176
         }
177 177
         if (isset($this->attributes['fed:logo_file'])) {
178 178
             $this->loggerInstance->debug(5, "saving FED logo\n");
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $this->support_url_substitute = sprintf(_("your local %s support page"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
189 189
 
190 190
         if ($this->signer && $this->options['sign']) {
191
-            $this->sign = ROOT . '/signer/' . $this->signer;
191
+            $this->sign = ROOT.'/signer/'.$this->signer;
192 192
         }
193 193
         $this->installerBasename = $this->getInstallerBasename();
194 194
         common\Entity::outOfThePotatoes();
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
      * @return string|boolean the filename as found, with path, or FALSE if it does not exist
245 245
      */
246 246
     private function findSourceFile($file) {
247
-        if (is_file($this->module_path . '/Files/' . $this->device_id . '/' . $file)) {
248
-            return $this->module_path . '/Files/' . $this->device_id . '/' . $file;
249
-        } elseif (is_file($this->module_path . '/Files/' . $file)) {
250
-            return $this->module_path . '/Files/' . $file;
247
+        if (is_file($this->module_path.'/Files/'.$this->device_id.'/'.$file)) {
248
+            return $this->module_path.'/Files/'.$this->device_id.'/'.$file;
249
+        } elseif (is_file($this->module_path.'/Files/'.$file)) {
250
+            return $this->module_path.'/Files/'.$file;
251 251
         } else {
252 252
             $this->loggerInstance->debug(2, "requested file $file does not exist\n");
253 253
             return FALSE;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
         $this->loggerInstance->debug(5, "translateFile($source_name, $output_name, $encoding)\n");
325 325
         ob_start();
326
-        $this->loggerInstance->debug(5, $this->module_path . '/Files/' . $this->device_id . '/' . $source_name . "\n");
326
+        $this->loggerInstance->debug(5, $this->module_path.'/Files/'.$this->device_id.'/'.$source_name."\n");
327 327
         $source = $this->findSourceFile($source_name);
328 328
         
329 329
         if ($source !== FALSE) { // if there is no file found, don't attempt to include an uninitialised variable
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         }
332 332
         $output = ob_get_clean();
333 333
         if ($encoding) {
334
-            $outputClean = iconv('UTF-8', $encoding . '//TRANSLIT', $output);
334
+            $outputClean = iconv('UTF-8', $encoding.'//TRANSLIT', $output);
335 335
             if ($outputClean) {
336 336
                 $output = $outputClean;
337 337
             }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             return $sourceString;
372 372
         }
373 373
         if (CONFIG_CONFASSISTANT['NSIS_VERSION'] < 3) {
374
-            $output_c = iconv('UTF-8', $encoding . '//TRANSLIT', $sourceString);
374
+            $output_c = iconv('UTF-8', $encoding.'//TRANSLIT', $sourceString);
375 375
         } else {
376 376
             $output_c = $sourceString;
377 377
         }
@@ -465,17 +465,17 @@  discard block
 block discarded – undo
465 465
      */
466 466
     private function getInstallerBasename() {
467 467
         
468
-        $baseName = $this->customTranslit(CONFIG_CONFASSISTANT['CONSORTIUM']['name']) . "-" . $this->getDeviceId();
468
+        $baseName = $this->customTranslit(CONFIG_CONFASSISTANT['CONSORTIUM']['name'])."-".$this->getDeviceId();
469 469
         if (isset($this->attributes['profile:customsuffix'][1])) { 
470 470
             // this string will end up as a filename on a filesystem, so always
471 471
             // take a latin-based language variant if available
472 472
             // and then scrub non-ASCII just in case
473
-            return $baseName . $this->customTranslit($this->attributes['profile:customsuffix'][1]);
473
+            return $baseName.$this->customTranslit($this->attributes['profile:customsuffix'][1]);
474 474
         }
475 475
         // Okay, no custom suffix. 
476 476
         // Use the configured inst name and apply shortening heuristics
477 477
         $lang_pointer = CONFIG['LANGUAGES'][$this->languageInstance->getLang()]['latin_based'] == TRUE ? 0 : 1;
478
-        $this->loggerInstance->debug(5, "getInstallerBasename1:" . $this->attributes['general:instname'][$lang_pointer] . "\n");
478
+        $this->loggerInstance->debug(5, "getInstallerBasename1:".$this->attributes['general:instname'][$lang_pointer]."\n");
479 479
         $inst = $this->customTranslit($this->attributes['general:instname'][$lang_pointer]);
480 480
         $this->loggerInstance->debug(4, "getInstallerBasename2:$inst\n");
481 481
         $Inst_a = explode('_', $inst);
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
             if (!empty($this->attributes['profile:name']) && !empty($this->attributes['profile:name'][$lang_pointer])) {
491 491
                 $profTemp = $this->customTranslit($this->attributes['profile:name'][$lang_pointer]);
492 492
                 $prof = preg_replace('/_+$/', '', $profTemp);
493
-                return $baseName . $inst . '-' . $prof;
493
+                return $baseName.$inst.'-'.$prof;
494 494
             }
495 495
         }
496
-        return $baseName . $inst;
496
+        return $baseName.$inst;
497 497
     }
498 498
 
499 499
     /**
@@ -561,13 +561,13 @@  discard block
 block discarded – undo
561 561
      * @return array
562 562
      */
563 563
     private function getConsortia() {
564
-        if(!isset(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])) {
564
+        if (!isset(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])) {
565 565
             return ([]);
566 566
         }
567 567
         $consortia = CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'];
568 568
         if (isset($this->attributes['media:consortium_OI'])) {
569 569
             foreach ($this->attributes['media:consortium_OI'] as $new_oi) {
570
-                if(!in_array($new_oi, $consortia)) {
570
+                if (!in_array($new_oi, $consortia)) {
571 571
                     $consortia[] = $new_oi;
572 572
                 }
573 573
             }
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
      * @return array list of filenames and the mime types
594 594
      * @throws Exception
595 595
      */
596
-    private function saveLogoFile($logos,$type) {
596
+    private function saveLogoFile($logos, $type) {
597 597
         $iterator = 0;
598 598
         $returnarray = [];
599 599
         foreach ($logos as $blob) {
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
                 $ext = 'unsupported';
607 607
             }
608 608
             $this->loggerInstance->debug(5, "saveLogoFile: $mime : $ext\n");
609
-            $fileName = 'logo-' . $type . $iterator . '.' . $ext;
609
+            $fileName = 'logo-'.$type.$iterator.'.'.$ext;
610 610
             $fileHandle = fopen($fileName, "w");
611 611
             if (!$fileHandle) {
612 612
                 $this->loggerInstance->debug(2, "saveLogoFile failed for: $fileName\n");
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
         $mime = $finfo->buffer($blob);
633 633
         $ext = isset($this->mime_extensions[$mime]) ? $this->mime_extensions[$mime] : 'usupported';
634 634
         $this->loggerInstance->debug(5, "saveInfoFile: $mime : $ext\n");
635
-        $fileHandle = fopen('local-info.' . $ext, "w");
635
+        $fileHandle = fopen('local-info.'.$ext, "w");
636 636
         if ($fileHandle === FALSE) {
637 637
             throw new Exception("problem opening the file");
638 638
         }
639 639
         fwrite($fileHandle, $blob);
640 640
         fclose($fileHandle);
641
-        return(['name' => 'local-info.' . $ext, 'mime' => $ext]);
641
+        return(['name' => 'local-info.'.$ext, 'mime' => $ext]);
642 642
     }
643 643
 
644 644
     /**
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
     protected function determineOuterIdString() {
690 690
         $outerId = NULL;
691 691
         if (isset($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset($this->attributes['internal:realm'])) {
692
-            $outerId = "@" . $this->attributes['internal:realm'][0];
692
+            $outerId = "@".$this->attributes['internal:realm'][0];
693 693
             if (isset($this->attributes['internal:anon_local_value'])) {
694
-                $outerId = $this->attributes['internal:anon_local_value'][0] . $outerId;
694
+                $outerId = $this->attributes['internal:anon_local_value'][0].$outerId;
695 695
             }
696 696
         }
697 697
         return $outerId;
Please login to merge, or discard this patch.