Passed
Push — release_2_0 ( 54acd9...58ed09 )
by Stefan
06:55
created
core/DeviceConfig.php 1 patch
Spacing   +23 added lines, -23 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
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             throw new Exception("No EAP type available.");
127 127
         }
128 128
         $this->attributes = $this->getProfileAttributes($profile);
129
-        $this->deviceUUID = common\Entity::uuid('', 'CAT' . $profile->institution . "-" . $profile->identifier . "-" . $this->device_id);
129
+        $this->deviceUUID = common\Entity::uuid('', 'CAT'.$profile->institution."-".$profile->identifier."-".$this->device_id);
130 130
 
131 131
 
132 132
         // if we are instantiating a Silverbullet profile AND have been given
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
         // create temporary directory, its full path will be saved in $this->FPATH;
151 151
         $tempDir = $this->createTemporaryDirectory($purpose);
152 152
         $this->FPATH = $tempDir['dir'];
153
-        mkdir($tempDir['dir'] . '/tmp');
154
-        chdir($tempDir['dir'] . '/tmp');
153
+        mkdir($tempDir['dir'].'/tmp');
154
+        chdir($tempDir['dir'].'/tmp');
155 155
         $caList = [];
156 156
         $x509 = new \core\common\X509();
157 157
         if (isset($this->attributes['eap:ca_file'])) {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         }
172 172
         if (isset($this->attributes['general:logo_file'])) {
173 173
             $this->loggerInstance->debug(5, "saving IDP logo\n");
174
-            $this->attributes['internal:logo_file'] = $this->saveLogoFile($this->attributes['general:logo_file'],'idp');
174
+            $this->attributes['internal:logo_file'] = $this->saveLogoFile($this->attributes['general:logo_file'], 'idp');
175 175
         }
176 176
         if (isset($this->attributes['fed:logo_file'])) {
177 177
             $this->loggerInstance->debug(5, "saving FED logo\n");
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $this->support_url_substitute = sprintf(_("your local %s support page"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
188 188
 
189 189
         if ($this->signer && $this->options['sign']) {
190
-            $this->sign = ROOT . '/signer/' . $this->signer;
190
+            $this->sign = ROOT.'/signer/'.$this->signer;
191 191
         }
192 192
         $this->installerBasename = $this->getInstallerBasename();
193 193
         common\Entity::outOfThePotatoes();
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
      * @return string|boolean the filename as found, with path, or FALSE if it does not exist
244 244
      */
245 245
     protected function findSourceFile($file) {
246
-        if (is_file($this->module_path . '/Files/' . $this->device_id . '/' . $file)) {
247
-            return $this->module_path . '/Files/' . $this->device_id . '/' . $file;
248
-        } elseif (is_file($this->module_path . '/Files/' . $file)) {
249
-            return $this->module_path . '/Files/' . $file;
246
+        if (is_file($this->module_path.'/Files/'.$this->device_id.'/'.$file)) {
247
+            return $this->module_path.'/Files/'.$this->device_id.'/'.$file;
248
+        } elseif (is_file($this->module_path.'/Files/'.$file)) {
249
+            return $this->module_path.'/Files/'.$file;
250 250
         } else {
251 251
             $this->loggerInstance->debug(2, "requested file $file does not exist\n");
252 252
             return FALSE;
@@ -367,17 +367,17 @@  discard block
 block discarded – undo
367 367
      */
368 368
     private function getInstallerBasename() {
369 369
         
370
-        $baseName = $this->customTranslit(CONFIG_CONFASSISTANT['CONSORTIUM']['name']) . "-" . $this->getDeviceId();
370
+        $baseName = $this->customTranslit(CONFIG_CONFASSISTANT['CONSORTIUM']['name'])."-".$this->getDeviceId();
371 371
         if (isset($this->attributes['profile:customsuffix'][1])) { 
372 372
             // this string will end up as a filename on a filesystem, so always
373 373
             // take a latin-based language variant if available
374 374
             // and then scrub non-ASCII just in case
375
-            return $baseName . $this->customTranslit($this->attributes['profile:customsuffix'][1]);
375
+            return $baseName.$this->customTranslit($this->attributes['profile:customsuffix'][1]);
376 376
         }
377 377
         // Okay, no custom suffix. 
378 378
         // Use the configured inst name and apply shortening heuristics
379 379
         $lang_pointer = CONFIG['LANGUAGES'][$this->languageInstance->getLang()]['latin_based'] == TRUE ? 0 : 1;
380
-        $this->loggerInstance->debug(5, "getInstallerBasename1:" . $this->attributes['general:instname'][$lang_pointer] . "\n");
380
+        $this->loggerInstance->debug(5, "getInstallerBasename1:".$this->attributes['general:instname'][$lang_pointer]."\n");
381 381
         $inst = $this->customTranslit($this->attributes['general:instname'][$lang_pointer]);
382 382
         $this->loggerInstance->debug(4, "getInstallerBasename2:$inst\n");
383 383
         $Inst_a = explode('_', $inst);
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
             if (!empty($this->attributes['profile:name']) && !empty($this->attributes['profile:name'][$lang_pointer])) {
393 393
                 $profTemp = $this->customTranslit($this->attributes['profile:name'][$lang_pointer]);
394 394
                 $prof = preg_replace('/_+$/', '', $profTemp);
395
-                return $baseName . $inst . '-' . $prof;
395
+                return $baseName.$inst.'-'.$prof;
396 396
             }
397 397
         }
398
-        return $baseName . $inst;
398
+        return $baseName.$inst;
399 399
     }
400 400
 
401 401
     /**
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
      * @return array
464 464
      */
465 465
     private function getConsortia() {
466
-        if(!isset(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])) {
466
+        if (!isset(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])) {
467 467
             return ([]);
468 468
         }
469 469
         $consortia = CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'];
470 470
         if (isset($this->attributes['media:consortium_OI'])) {
471 471
             foreach ($this->attributes['media:consortium_OI'] as $new_oi) {
472
-                if(!in_array($new_oi, $consortia)) {
472
+                if (!in_array($new_oi, $consortia)) {
473 473
                     $consortia[] = $new_oi;
474 474
                 }
475 475
             }
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @return array list of filenames and the mime types
496 496
      * @throws Exception
497 497
      */
498
-    private function saveLogoFile($logos,$type) {
498
+    private function saveLogoFile($logos, $type) {
499 499
         $iterator = 0;
500 500
         $returnarray = [];
501 501
         foreach ($logos as $blob) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                 $ext = 'unsupported';
509 509
             }
510 510
             $this->loggerInstance->debug(5, "saveLogoFile: $mime : $ext\n");
511
-            $fileName = 'logo-' . $type . $iterator . '.' . $ext;
511
+            $fileName = 'logo-'.$type.$iterator.'.'.$ext;
512 512
             $fileHandle = fopen($fileName, "w");
513 513
             if (!$fileHandle) {
514 514
                 $this->loggerInstance->debug(2, "saveLogoFile failed for: $fileName\n");
@@ -534,13 +534,13 @@  discard block
 block discarded – undo
534 534
         $mime = $finfo->buffer($blob);
535 535
         $ext = isset($this->mime_extensions[$mime]) ? $this->mime_extensions[$mime] : 'usupported';
536 536
         $this->loggerInstance->debug(5, "saveInfoFile: $mime : $ext\n");
537
-        $fileHandle = fopen('local-info.' . $ext, "w");
537
+        $fileHandle = fopen('local-info.'.$ext, "w");
538 538
         if ($fileHandle === FALSE) {
539 539
             throw new Exception("problem opening the file");
540 540
         }
541 541
         fwrite($fileHandle, $blob);
542 542
         fclose($fileHandle);
543
-        return(['name' => 'local-info.' . $ext, 'mime' => $ext]);
543
+        return(['name' => 'local-info.'.$ext, 'mime' => $ext]);
544 544
     }
545 545
 
546 546
     /**
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
     protected function determineOuterIdString() {
592 592
         $outerId = NULL;
593 593
         if (isset($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset($this->attributes['internal:realm'])) {
594
-            $outerId = "@" . $this->attributes['internal:realm'][0];
594
+            $outerId = "@".$this->attributes['internal:realm'][0];
595 595
             if (isset($this->attributes['internal:anon_local_value'])) {
596
-                $outerId = $this->attributes['internal:anon_local_value'][0] . $outerId;
596
+                $outerId = $this->attributes['internal:anon_local_value'][0].$outerId;
597 597
             }
598 598
         }
599 599
         return $outerId;
Please login to merge, or discard this patch.