Passed
Push — master ( f2311c...40d0b6 )
by Burak
01:45
created
src/SEOCheckup/Analyze.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
         {
113 113
             $i++;
114 114
 
115
-            if($i >= 25)
115
+            if ($i >= 25)
116 116
                 break;
117 117
 
118 118
             $status = $this->Request($link)->getStatusCode();
119 119
 
120
-            if(substr($status,0,1) > 3 && $status != 999)
120
+            if (substr($status, 0, 1) > 3 && $status != 999)
121 121
                 $scan['errors']["HTTP {$status}"][] = $link;
122 122
             else
123 123
                 $scan['passed']["HTTP {$status}"][] = $link;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         {
142 142
             foreach ($header as $item)
143 143
             {
144
-                if(strpos(mb_strtolower($item),'cache') !== false)
144
+                if (strpos(mb_strtolower($item), 'cache') !== false)
145 145
                 {
146 146
                     $output['headers'][] = $item;
147 147
                 }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
         foreach ($xpath->query('//comment()') as $comment)
156 156
         {
157
-            if(strpos(mb_strtolower($comment->textContent),'cache') !== false)
157
+            if (strpos(mb_strtolower($comment->textContent), 'cache') !== false)
158 158
             {
159 159
                 $output['html'][] = '<!-- '.trim($comment->textContent).' //-->';
160 160
             }
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
         $output = array();
175 175
         $links  = $this->helpers->GetAttributes($dom, 'link', 'rel');
176 176
 
177
-        foreach($links as $item)
177
+        foreach ($links as $item)
178 178
         {
179
-            if($item == 'canonical')
179
+            if ($item == 'canonical')
180 180
             {
181 181
                 $output[] = $item;
182 182
             }
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
 
198 198
         foreach ($this->data['headers'] as $key => $header)
199 199
         {
200
-            if($key == 'Content-Type')
200
+            if ($key == 'Content-Type')
201 201
             {
202
-                $output = explode('=', explode(';',$header[0])[1])[1];
202
+                $output = explode('=', explode(';', $header[0])[1])[1];
203 203
             }
204 204
         }
205 205
         return $this->Output($output, __FUNCTION__);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function DeprecatedHTML()
252 252
     {
253
-        $dom       = $this->DOMDocument();
253
+        $dom = $this->DOMDocument();
254 254
         $dom->loadHTML($this->data['content']);
255 255
 
256 256
         $deprecated_tags = array(
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 
276 276
         foreach ($deprecated_tags as $tag)
277 277
         {
278
-            $tags   = $dom->getElementsByTagName($tag);
278
+            $tags = $dom->getElementsByTagName($tag);
279 279
 
280
-            if($tags->length > 0)
280
+            if ($tags->length > 0)
281 281
             {
282 282
                 $output[$tag] = $tags->length;
283 283
             }
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
      */
294 294
     public function DomainLength()
295 295
     {
296
-        $domain = explode('.',$this->data['parsed_url']['host']);
296
+        $domain = explode('.', $this->data['parsed_url']['host']);
297 297
 
298 298
         array_pop($domain);
299 299
 
300
-        $domain = implode('.',$domain);
300
+        $domain = implode('.', $domain);
301 301
 
302 302
         return $this->Output(strlen($domain), __FUNCTION__);
303 303
     }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         $ico    = "{$this->data['parsed_url']['scheme']}://{$this->data['parsed_url']['host']}/favicon.ico";
313 313
         $link   = '';
314 314
 
315
-        if($this->Request($ico)->getStatusCode() === 200)
315
+        if ($this->Request($ico)->getStatusCode() === 200)
316 316
         {
317 317
             $link   = $ico;
318 318
         } else {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
             foreach ($tags as $tag)
327 327
             {
328
-                if($tag->getAttribute('rel') == 'shortcut icon' OR $tag->getAttribute('rel') == 'icon')
328
+                if ($tag->getAttribute('rel') == 'shortcut icon' OR $tag->getAttribute('rel') == 'icon')
329 329
                 {
330 330
                     $fav = $tag->getAttribute('href');
331 331
                     break;
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
             if (!filter_var($fav, FILTER_VALIDATE_URL) === false && $this->Request($fav)->getStatusCode() == 200)
336 336
             {
337 337
                 $link = $fav;
338
-            } else if($this->Request($this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav)->getStatusCode() == 200)
338
+            } else if ($this->Request($this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav)->getStatusCode() == 200)
339 339
             {
340 340
                 $link = $this->data['parsed_url']['scheme'].'://'.$this->data['parsed_url']['host'].'/'.$fav;
341
-            } else if($this->Request($_GET['value'].'/'.$fav)->getStatusCode() == 200)
341
+            } else if ($this->Request($_GET['value'].'/'.$fav)->getStatusCode() == 200)
342 342
             {
343 343
                 $link = $_GET['value'].'/'.$fav;
344 344
             } else {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $output['frameset'][] = null;
368 368
         }
369 369
 
370
-        $tags   = $dom->getElementsByTagName('frame');
370
+        $tags = $dom->getElementsByTagName('frame');
371 371
         foreach ($tags as $tag)
372 372
         {
373 373
             $output['frame'][] = null;
@@ -394,26 +394,26 @@  discard block
 block discarded – undo
394 394
         $tags   = $dom->getElementsByTagName('script');
395 395
         foreach ($tags as $tag)
396 396
         {
397
-            if($tag->getAttribute('src'))
397
+            if ($tag->getAttribute('src'))
398 398
             {
399 399
                 if (0 === strpos($tag->getAttribute('src'), '//'))
400 400
                 {
401
-                    $href     = $this->data['parsed_url']['scheme'] . ':'.$tag->getAttribute('src');
401
+                    $href     = $this->data['parsed_url']['scheme'].':'.$tag->getAttribute('src');
402 402
                 } else if (0 !== strpos($tag->getAttribute('src'), 'http'))
403 403
                 {
404
-                    $path     = '/' . ltrim($tag->getAttribute('src'), '/');
405
-                    $href     = $this->data['parsed_url']['scheme'] . '://';
404
+                    $path     = '/'.ltrim($tag->getAttribute('src'), '/');
405
+                    $href     = $this->data['parsed_url']['scheme'].'://';
406 406
 
407 407
                     if (isset($this->data['parsed_url']['user']) && isset($this->data['parsed_url']['pass']))
408 408
                     {
409
-                        $href .= $this->data['parsed_url']['user'] . ':' . $this->data['parsed_url']['pass'] . '@';
409
+                        $href .= $this->data['parsed_url']['user'].':'.$this->data['parsed_url']['pass'].'@';
410 410
                     }
411 411
 
412 412
                     $href     .= $this->data['parsed_url']['host'];
413 413
 
414 414
                     if (isset($this->data['parsed_url']['port']))
415 415
                     {
416
-                        $href .= ':' . $this->data['parsed_url']['port'];
416
+                        $href .= ':'.$this->data['parsed_url']['port'];
417 417
                     }
418 418
                     $href    .= $path;
419 419
                 } else {
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             }
427 427
         }
428 428
 
429
-        $ua_regex        = "/UA-[0-9]{5,}-[0-9]{1,}/";
429
+        $ua_regex = "/UA-[0-9]{5,}-[0-9]{1,}/";
430 430
 
431 431
         preg_match_all($ua_regex, $script, $ua_id);
432 432
 
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
      */
493 493
     public function ImageAlt()
494 494
     {
495
-        $dom    = $this->DOMDocument();
495
+        $dom = $this->DOMDocument();
496 496
         $dom->loadHTML($this->data['content']);
497 497
 
498 498
         $tags         = $dom->getElementsByTagName('img');
499 499
         $images       = array();
500 500
         $errors       = array();
501 501
 
502
-        foreach($tags as $item)
502
+        foreach ($tags as $item)
503 503
         {
504 504
             $src      = $item->getAttribute('src');
505 505
             $alt      = $item->getAttribute('alt');
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                 'alt' => $alt
510 510
             );
511 511
 
512
-            if($alt == '')
512
+            if ($alt == '')
513 513
             {
514 514
                 $link = $src;
515 515
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
             }
518 518
         }
519 519
 
520
-        $output       = array(
520
+        $output = array(
521 521
             'images'        => $images,
522 522
             'without_alt'   => $errors
523 523
         );
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
     {
535 535
         $output               = array();
536 536
 
537
-        $output['actual']     = round(strlen($this->data['content']) / 1024,2);
537
+        $output['actual']     = round(strlen($this->data['content']) / 1024, 2);
538 538
         $output['possible']   = gzcompress($this->data['content'], 9);
539
-        $output['possible']   = round(strlen($output['possible']) / 1024,2);
540
-        $output['percentage'] = round((($output['possible'] * 100) / $output['actual']),2);
541
-        $output['difference'] = round($output['actual'] - $output['possible'],2);
539
+        $output['possible']   = round(strlen($output['possible']) / 1024, 2);
540
+        $output['percentage'] = round((($output['possible'] * 100) / $output['actual']), 2);
541
+        $output['difference'] = round($output['actual'] - $output['possible'], 2);
542 542
 
543 543
         return $this->Output($output, __FUNCTION__);
544 544
     }
Please login to merge, or discard this patch.