Passed
Push — release_2_1 ( 1f38df...1cb6d0 )
by Tomasz
09:25
created
web/lib/admin/API.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     const ACTIONS = [
255 255
         // Inst-level actions.
256 256
         API::ACTION_NEWINST_BY_REF => [
257
-            "REQ" => [API::AUXATTRIB_EXTERNALID,],
257
+            "REQ" => [API::AUXATTRIB_EXTERNALID, ],
258 258
             "OPT" => [
259 259
                 'general:geo_coordinates',
260 260
                 'general:logo_file',
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             "FLAG" => [],
272 272
         ],
273 273
         API::ACTION_NEWINST => [
274
-            "REQ" => [API::AUXATTRIB_INSTTYPE,], // "IdP", "SP" or "IdPSP"
274
+            "REQ" => [API::AUXATTRIB_INSTTYPE, ], // "IdP", "SP" or "IdPSP"
275 275
             "OPT" => [
276 276
                 'general:instname',
277 277
                 'general:geo_coordinates',
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     public function scrub($inputJson, $fedObject) {        
491 491
         $optionInstance = \core\Options::instance();
492 492
         $parameters = [];
493
-        $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'],  API::ACTIONS[$inputJson['ACTION']]['FLAG']);
493
+        $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'], API::ACTIONS[$inputJson['ACTION']]['FLAG']);
494 494
         // some actions don't need parameters. Don't get excited when there aren't any.
495 495
         if (!isset($inputJson['PARAMETERS'])) {
496 496
             return [];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                         break;
534 534
                 }   
535 535
             } elseif (preg_match("/^FLAG-/", $oneIncomingParam['NAME'])) {
536
-                if ($oneIncomingParam['VALUE'] != "TRUE" && $oneIncomingParam['VALUE'] != "FALSE" ) {
536
+                if ($oneIncomingParam['VALUE'] != "TRUE" && $oneIncomingParam['VALUE'] != "FALSE") {
537 537
                     continue;
538 538
                 }
539 539
             } else {
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 
592 592
                 case \core\Options::TYPECODE_COORDINATES:
593 593
                     $extension = \core\Options::TYPECODE_TEXT;
594
-                    $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#";
595
-                    $coercedInline["value"][$basename . "-" . $extension] = $oneAttrib['VALUE'];
594
+                    $coercedInline["option"][$basename] = $oneAttrib['NAME']."#";
595
+                    $coercedInline["value"][$basename."-".$extension] = $oneAttrib['VALUE'];
596 596
                     break;
597 597
                 case \core\Options::TYPECODE_TEXT:
598 598
                 // Fall-through: they all get the same treatment.
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
                 // Fall-through: they all get the same treatment.
603 603
                 case \core\Options::TYPECODE_INTEGER:
604 604
                     $extension = $optionInfo['type'];
605
-                    $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#";
606
-                    $coercedInline["value"][$basename . "-" . $extension] = $oneAttrib['VALUE'];
605
+                    $coercedInline["option"][$basename] = $oneAttrib['NAME']."#";
606
+                    $coercedInline["value"][$basename."-".$extension] = $oneAttrib['VALUE'];
607 607
                     if ($optionInfo['flag'] == "ML") {
608
-                        $coercedInline["value"][$basename . "-lang"] = $oneAttrib['LANG'];
608
+                        $coercedInline["value"][$basename."-lang"] = $oneAttrib['LANG'];
609 609
                     }
610 610
                     break;
611 611
                 case \core\Options::TYPECODE_FILE:
612 612
                     // Binary data is expected in base64 encoding. This is true also for PEM files!
613 613
                     $extension = $optionInfo['type'];
614
-                    $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#";
615
-                    file_put_contents($dir['dir'] . "/" . $basename . "-" . $extension, base64_decode($oneAttrib['VALUE']));
616
-                    $coercedFile["value"]['tmp_name'][$basename . "-" . $extension] = $dir['dir'] . "/" . $basename . "-" . $extension;
614
+                    $coercedInline["option"][$basename] = $oneAttrib['NAME']."#";
615
+                    file_put_contents($dir['dir']."/".$basename."-".$extension, base64_decode($oneAttrib['VALUE']));
616
+                    $coercedFile["value"]['tmp_name'][$basename."-".$extension] = $dir['dir']."/".$basename."-".$extension;
617 617
                     break;
618 618
                 default:
619 619
                     throw new Exception("We don't seem to know this type code!");
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     public function returnSuccess($details) {
643 643
         $output = json_encode(["result" => "SUCCESS", "details" => $details], JSON_PRETTY_PRINT);
644 644
         if ($output === FALSE) {
645
-            $this->returnError(API::ERROR_INTERNAL_ERROR, "Unable to JSON encode return data: ". json_last_error(). " - ". json_last_error_msg());
645
+            $this->returnError(API::ERROR_INTERNAL_ERROR, "Unable to JSON encode return data: ".json_last_error()." - ".json_last_error_msg());
646 646
         }
647 647
         else {
648 648
             echo $output;
Please login to merge, or discard this patch.