Passed
Push — master ( b399c9...7b0af8 )
by Tim
02:06
created
www/get.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@
 block discarded – undo
35 35
     $xml = \SimpleSAML\Utils\XML::::formatXMLString($xml);
36 36
 }
37 37
 
38
-header('Content-Type: '.$mimetype);
38
+header('Content-Type: ' . $mimetype);
39 39
 header('Content-Length: ' . strlen($xml));
40 40
 
41 41
 /*
42 42
  * At this point, if the ID was forged, getMetadata() would
43 43
  * have failed to find a valid metadata set, so we can trust it.
44 44
  */
45
-header('Content-Disposition: filename='.$id.'.xml');
45
+header('Content-Disposition: filename=' . $id . '.xml');
46 46
 
47 47
 echo $xml;
Please login to merge, or discard this patch.
lib/Aggregator.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         assert('is_string($id)');
191 191
 
192 192
         $this->id = $id;
193
-        $this->logLoc = 'aggregator2:'.$this->id.': ';
193
+        $this->logLoc = 'aggregator2:' . $this->id . ': ';
194 194
 
195 195
         $this->cronTag = $config->getString('cron.tag', null);
196 196
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $signKey = System::resolvePath($signKey, $certDir);
222 222
             $this->signKey = @file_get_contents($signKey);
223 223
             if ($this->signKey === null) {
224
-                throw new Exception('Unable to load private key from '.var_export($signKey, true));
224
+                throw new Exception('Unable to load private key from ' . var_export($signKey, true));
225 225
             }
226 226
         }
227 227
 
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
             $signCert = System::resolvePath($signCert, $certDir);
233 233
             $this->signCert = @file_get_contents($signCert);
234 234
             if ($this->signCert === null) {
235
-                throw new Exception('Unable to load certificate file from '.var_export($signCert, true));
235
+                throw new Exception('Unable to load certificate file from ' . var_export($signCert, true));
236 236
             }
237 237
         }
238 238
 
239 239
         $this->signAlg = $config->getString('sign.algorithm', XMLSecurityKey::RSA_SHA1);
240 240
         if (!in_array($this->signAlg, self::$SUPPORTED_SIGNATURE_ALGORITHMS)) {
241
-            throw new Exception('Unsupported signature algorithm '.var_export($this->signAlg, true));
241
+            throw new Exception('Unsupported signature algorithm ' . var_export($this->signAlg, true));
242 242
         }
243 243
 
244 244
         $this->sslCAFile = $config->getString('ssl.cafile', null);
@@ -304,24 +304,24 @@  discard block
 block discarded – undo
304 304
         assert('is_int($expires)');
305 305
         assert('is_null($tag) || is_string($tag)');
306 306
 
307
-        $cacheFile = $this->cacheDirectory.'/'.$id;
307
+        $cacheFile = $this->cacheDirectory . '/' . $id;
308 308
         try {
309 309
             System::writeFile($cacheFile, $data);
310 310
         } catch (\Exception $e) {
311
-            Logger::warning($this->logLoc.'Unable to write to cache file '.var_export($cacheFile, true));
311
+            Logger::warning($this->logLoc . 'Unable to write to cache file ' . var_export($cacheFile, true));
312 312
             return;
313 313
         }
314 314
 
315
-        $expireInfo = (string)$expires;
315
+        $expireInfo = (string) $expires;
316 316
         if ($tag !== null) {
317
-            $expireInfo .= ':'.$tag;
317
+            $expireInfo .= ':' . $tag;
318 318
         }
319 319
 
320
-        $expireFile = $cacheFile.'.expire';
320
+        $expireFile = $cacheFile . '.expire';
321 321
         try {
322 322
             System::writeFile($expireFile, $expireInfo);
323 323
         } catch (\Exception $e) {
324
-            Logger::warning($this->logLoc.'Unable to write expiration info to '.var_export($expireFile, true));
324
+            Logger::warning($this->logLoc . 'Unable to write expiration info to ' . var_export($expireFile, true));
325 325
         }
326 326
     }
327 327
 
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
         assert('is_string($id)');
339 339
         assert('is_null($tag) || is_string($tag)');
340 340
 
341
-        $cacheFile = $this->cacheDirectory.'/'.$id;
341
+        $cacheFile = $this->cacheDirectory . '/' . $id;
342 342
         if (!file_exists($cacheFile)) {
343 343
             return false;
344 344
         }
345 345
 
346
-        $expireFile = $cacheFile.'.expire';
346
+        $expireFile = $cacheFile . '.expire';
347 347
         if (!file_exists($expireFile)) {
348 348
             return false;
349 349
         }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             return null;
390 390
         }
391 391
 
392
-        $cacheFile = $this->cacheDirectory.'/'.$id;
392
+        $cacheFile = $this->cacheDirectory . '/' . $id;
393 393
         return @file_get_contents($cacheFile);
394 394
     }
395 395
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     {
405 405
         assert('is_string($id)');
406 406
 
407
-        $cacheFile = $this->cacheDirectory.'/'.$id;
407
+        $cacheFile = $this->cacheDirectory . '/' . $id;
408 408
         if (!file_exists($cacheFile)) {
409 409
             return null;
410 410
         }
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         }
617 617
         $this->excluded = $entities;
618 618
         sort($this->excluded);
619
-        $this->cacheId = sha1($this->cacheId.serialize($this->excluded));
619
+        $this->cacheId = sha1($this->cacheId . serialize($this->excluded));
620 620
     }
621 621
 
622 622
 
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
         $options = ['saml2', 'shib13', 'saml20-aa', 'shib13-aa'];
676 676
         $this->roles['SAML2_XML_md_AttributeAuthorityDescriptor'] = (array_intersect($set, $options) !== []);
677 677
 
678
-        $this->cacheId = sha1($this->cacheId.serialize($this->protocols).serialize($this->roles));
678
+        $this->cacheId = sha1($this->cacheId . serialize($this->protocols) . serialize($this->roles));
679 679
     }
680 680
 
681 681
 
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
         $xml = $xml->ownerDocument->saveXML($xml);
699 699
 
700 700
         if ($this->cacheGenerated !== null) {
701
-            Logger::debug($this->logLoc.'Saving generated metadata to cache.');
701
+            Logger::debug($this->logLoc . 'Saving generated metadata to cache.');
702 702
             $this->addCacheItem($this->cacheId, $xml, time() + $this->cacheGenerated, $this->cacheTag);
703 703
         }
704 704
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
         if ($this->cacheGenerated !== null) {
717 717
             $xml = $this->getCacheItem($this->cacheId, $this->cacheTag);
718 718
             if ($xml !== null) {
719
-                Logger::debug($this->logLoc.'Loaded generated metadata from cache.');
719
+                Logger::debug($this->logLoc . 'Loaded generated metadata from cache.');
720 720
                 return $xml;
721 721
             }
722 722
         }
Please login to merge, or discard this patch.
lib/EntitySource.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function __construct(Aggregator $aggregator, Configuration $config)
92 92
     {
93
-        $this->logLoc = 'aggregator2:'.$aggregator->getId().': ';
93
+        $this->logLoc = 'aggregator2:' . $aggregator->getId() . ': ';
94 94
         $this->aggregator = $aggregator;
95 95
 
96 96
         $this->url = $config->getString('url');
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
      */
115 115
     private function downloadMetadata()
116 116
     {
117
-        Logger::debug($this->logLoc.'Downloading metadata from '.var_export($this->url, true));
117
+        Logger::debug($this->logLoc . 'Downloading metadata from ' . var_export($this->url, true));
118 118
 
119 119
         $context = ['ssl' => []];
120 120
         if ($this->sslCAFile !== null) {
121 121
             $context['ssl']['cafile'] = Config::getCertPath($this->sslCAFile);
122
-            SimpleSAML\Logger::debug($this->logLoc.'Validating https connection against CA certificate(s) found in '.
122
+            SimpleSAML\Logger::debug($this->logLoc . 'Validating https connection against CA certificate(s) found in ' .
123 123
                 var_export($context['ssl']['cafile'], true));
124 124
             $context['ssl']['verify_peer'] = true;
125 125
             $context['ssl']['CN_match'] = parse_url($this->url, PHP_URL_HOST);
@@ -127,26 +127,26 @@  discard block
 block discarded – undo
127 127
 
128 128
         $data = HTTP::fetch($this->url, $context);
129 129
         if ($data === false || $data === null) {
130
-            Logger::error($this->logLoc.'Unable to load metadata from '.var_export($this->url, true));
130
+            Logger::error($this->logLoc . 'Unable to load metadata from ' . var_export($this->url, true));
131 131
             return null;
132 132
         }
133 133
 
134 134
         $doc = new DOMDocument();
135 135
         $res = $doc->loadXML($data);
136 136
         if (!$res) {
137
-            Logger::error($this->logLoc.'Error parsing XML from '.var_export($this->url, true));
137
+            Logger::error($this->logLoc . 'Error parsing XML from ' . var_export($this->url, true));
138 138
             return null;
139 139
         }
140 140
 
141 141
         $root = Utils::xpQuery($doc->firstChild, '/saml_metadata:EntityDescriptor|/saml_metadata:EntitiesDescriptor');
142 142
         if (count($root) === 0) {
143
-            Logger::error($this->logLoc.'No <EntityDescriptor> or <EntitiesDescriptor> in metadata from '.
143
+            Logger::error($this->logLoc . 'No <EntityDescriptor> or <EntitiesDescriptor> in metadata from ' .
144 144
                 var_export($this->url, true));
145 145
             return null;
146 146
         }
147 147
 
148 148
         if (count($root) > 1) {
149
-            Logger::error($this->logLoc.'More than one <EntityDescriptor> or <EntitiesDescriptor> in metadata from '.
149
+            Logger::error($this->logLoc . 'More than one <EntityDescriptor> or <EntitiesDescriptor> in metadata from ' .
150 150
                 var_export($this->url, true));
151 151
             return null;
152 152
         }
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                 $md = new EntitiesDescriptor($root);
160 160
             }
161 161
         } catch (\Exception $e) {
162
-            Logger::error($this->logLoc.'Unable to parse metadata from '.
163
-                var_export($this->url, true).': '.$e->getMessage());
162
+            Logger::error($this->logLoc . 'Unable to parse metadata from ' .
163
+                var_export($this->url, true) . ': ' . $e->getMessage());
164 164
             return null;
165 165
         }
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             $file = Config::getCertPath($this->certificate);
169 169
             $certData = file_get_contents($file);
170 170
             if ($certData === false) {
171
-                throw new Exception('Error loading certificate from '.var_export($file, true));
171
+                throw new Exception('Error loading certificate from ' . var_export($file, true));
172 172
             }
173 173
 
174 174
             // Extract the public key from the certificate for validation
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
             $key->loadKey($file, true);
177 177
 
178 178
             if (!$md->validate($key)) {
179
-                Logger::error($this->logLoc.'Error validating signature on metadata.');
179
+                Logger::error($this->logLoc . 'Error validating signature on metadata.');
180 180
                 return null;
181 181
             }
182
-            Logger::debug($this->logLoc.'Validated signature on metadata from '.var_export($this->url, true));
182
+            Logger::debug($this->logLoc . 'Validated signature on metadata from ' . var_export($this->url, true));
183 183
         }
184 184
 
185 185
         return $md;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             return null;
243 243
         }
244 244
 
245
-        Logger::debug($this->logLoc.'Using cached metadata from '.var_export($cacheFile, true));
245
+        Logger::debug($this->logLoc . 'Using cached metadata from ' . var_export($cacheFile, true));
246 246
 
247 247
         $metadata = file_get_contents($cacheFile);
248 248
         if ($metadata !== null) {
Please login to merge, or discard this patch.
templates/list.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 <?php
8 8
 if (count($this->data['sources']) === 0) {
9
-    echo "    <p>".$this->t('{aggregator2:aggregator:no_aggregators}')."</p>\n";
9
+    echo "    <p>" . $this->t('{aggregator2:aggregator:no_aggregators}') . "</p>\n";
10 10
 } else {
11 11
     echo "    <ul>";
12 12
 
@@ -15,17 +15,17 @@  discard block
 block discarded – undo
15 15
         $params = [
16 16
             'id' => $encId,
17 17
         ];
18
-        echo str_repeat(' ', 8)."<li>\n";
19
-        echo str_repeat(' ', 12).'<a href="';
20
-        echo SimpleSAML\Module::getModuleURL('aggregator2/get.php', $params).'">'.htmlspecialchars($id)."</a>\n";
21
-        echo str_repeat(' ', 12).'<a href="';
18
+        echo str_repeat(' ', 8) . "<li>\n";
19
+        echo str_repeat(' ', 12) . '<a href="';
20
+        echo SimpleSAML\Module::getModuleURL('aggregator2/get.php', $params) . '">' . htmlspecialchars($id) . "</a>\n";
21
+        echo str_repeat(' ', 12) . '<a href="';
22 22
         $params['mimetype'] = 'text/plain';
23
-        echo SimpleSAML\Module::getModuleURL('aggregator2/get.php', $params).'">['.
24
-            $this->t('{aggregator2:aggregator:text}')."]</a>\n";
25
-        echo str_repeat(' ', 12).'<a href="';
23
+        echo SimpleSAML\Module::getModuleURL('aggregator2/get.php', $params) . '">[' .
24
+            $this->t('{aggregator2:aggregator:text}') . "]</a>\n";
25
+        echo str_repeat(' ', 12) . '<a href="';
26 26
         $params['mimetype'] = 'application/xml';
27
-        echo SimpleSAML\Module::getModuleURL('aggregator2/get.php', $params)."\">[XML]</a>\n";
28
-        echo str_repeat(' ', 8)."</li>\n";
27
+        echo SimpleSAML\Module::getModuleURL('aggregator2/get.php', $params) . "\">[XML]</a>\n";
28
+        echo str_repeat(' ', 8) . "</li>\n";
29 29
     }
30 30
 
31 31
     echo "    </ul>\n";
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $projectRoot = dirname(__DIR__);
4
-require_once($projectRoot.'/vendor/autoload.php');
4
+require_once($projectRoot . '/vendor/autoload.php');
5 5
 
6 6
 // Symlink module into ssp vendor lib so that templates and urls can resolve correctly
7
-$linkPath = $projectRoot.'/vendor/simplesamlphp/simplesamlphp/modules/aggregator2';
7
+$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/aggregator2';
8 8
 if (file_exists($linkPath) === false) {
9 9
     echo "Linking '$linkPath' to '$projectRoot'\n";
10 10
     symlink($projectRoot, $linkPath);
Please login to merge, or discard this patch.