Passed
Push — master ( 7b0af8...472228 )
by Tim
01:55
created
lib/EntitySource.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function __construct(Aggregator $aggregator, Configuration $config)
94 94
     {
95
-        $this->logLoc = 'aggregator2:'.$aggregator->getId().': ';
95
+        $this->logLoc = 'aggregator2:' . $aggregator->getId() . ': ';
96 96
         $this->aggregator = $aggregator;
97 97
 
98 98
         $this->url = $config->getString('url');
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      */
117 117
     private function downloadMetadata()
118 118
     {
119
-        Logger::debug($this->logLoc.'Downloading metadata from '.var_export($this->url, true));
119
+        Logger::debug($this->logLoc . 'Downloading metadata from ' . var_export($this->url, true));
120 120
 
121 121
         $context = ['ssl' => []];
122 122
         if ($this->sslCAFile !== null) {
123 123
             $context['ssl']['cafile'] = Config::getCertPath($this->sslCAFile);
124
-            Logger::debug($this->logLoc.'Validating https connection against CA certificate(s) found in '.
124
+            Logger::debug($this->logLoc . 'Validating https connection against CA certificate(s) found in ' .
125 125
                 var_export($context['ssl']['cafile'], true));
126 126
             $context['ssl']['verify_peer'] = true;
127 127
             $context['ssl']['CN_match'] = parse_url($this->url, PHP_URL_HOST);
@@ -129,26 +129,26 @@  discard block
 block discarded – undo
129 129
 
130 130
         $data = HTTP::fetch($this->url, $context);
131 131
         if ($data === false || $data === null) {
132
-            Logger::error($this->logLoc.'Unable to load metadata from '.var_export($this->url, true));
132
+            Logger::error($this->logLoc . 'Unable to load metadata from ' . var_export($this->url, true));
133 133
             return null;
134 134
         }
135 135
 
136 136
         $doc = new \DOMDocument();
137 137
         $res = $doc->loadXML($data);
138 138
         if (!$res) {
139
-            Logger::error($this->logLoc.'Error parsing XML from '.var_export($this->url, true));
139
+            Logger::error($this->logLoc . 'Error parsing XML from ' . var_export($this->url, true));
140 140
             return null;
141 141
         }
142 142
 
143 143
         $root = Utils::xpQuery($doc->firstChild, '/saml_metadata:EntityDescriptor|/saml_metadata:EntitiesDescriptor');
144 144
         if (count($root) === 0) {
145
-            Logger::error($this->logLoc.'No <EntityDescriptor> or <EntitiesDescriptor> in metadata from '.
145
+            Logger::error($this->logLoc . 'No <EntityDescriptor> or <EntitiesDescriptor> in metadata from ' .
146 146
                 var_export($this->url, true));
147 147
             return null;
148 148
         }
149 149
 
150 150
         if (count($root) > 1) {
151
-            Logger::error($this->logLoc.'More than one <EntityDescriptor> or <EntitiesDescriptor> in metadata from '.
151
+            Logger::error($this->logLoc . 'More than one <EntityDescriptor> or <EntitiesDescriptor> in metadata from ' .
152 152
                 var_export($this->url, true));
153 153
             return null;
154 154
         }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $md = new EntitiesDescriptor($root);
162 162
             }
163 163
         } catch (\Exception $e) {
164
-            Logger::error($this->logLoc.'Unable to parse metadata from '.
165
-                var_export($this->url, true).': '.$e->getMessage());
164
+            Logger::error($this->logLoc . 'Unable to parse metadata from ' .
165
+                var_export($this->url, true) . ': ' . $e->getMessage());
166 166
             return null;
167 167
         }
168 168
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             $file = Config::getCertPath($this->certificate);
171 171
             $certData = file_get_contents($file);
172 172
             if ($certData === false) {
173
-                throw new Exception('Error loading certificate from '.var_export($file, true));
173
+                throw new Exception('Error loading certificate from ' . var_export($file, true));
174 174
             }
175 175
 
176 176
             // Extract the public key from the certificate for validation
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
             $key->loadKey($file, true);
179 179
 
180 180
             if (!$md->validate($key)) {
181
-                Logger::error($this->logLoc.'Error validating signature on metadata.');
181
+                Logger::error($this->logLoc . 'Error validating signature on metadata.');
182 182
                 return null;
183 183
             }
184
-            Logger::debug($this->logLoc.'Validated signature on metadata from '.var_export($this->url, true));
184
+            Logger::debug($this->logLoc . 'Validated signature on metadata from ' . var_export($this->url, true));
185 185
         }
186 186
 
187 187
         return $md;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             return null;
245 245
         }
246 246
 
247
-        Logger::debug($this->logLoc.'Using cached metadata from '.var_export($cacheFile, true));
247
+        Logger::debug($this->logLoc . 'Using cached metadata from ' . var_export($cacheFile, true));
248 248
 
249 249
         $metadata = file_get_contents($cacheFile);
250 250
         if ($metadata !== null) {
Please login to merge, or discard this patch.
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.