Passed
Push — master ( fef639...272ece )
by Burak
01:39
created
src/SEOCheckup/Analyze.php 1 patch
Spacing   +47 added lines, -47 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
         );
@@ -538,35 +538,35 @@  discard block
 block discarded – undo
538 538
         $tags   = $dom->getElementsByTagName('a');
539 539
         $output = array();
540 540
 
541
-        foreach($tags as $item)
541
+        foreach ($tags as $item)
542 542
         {
543 543
             $link = $item->getAttribute('href');
544 544
 
545
-            if($link != '' && strpos($link,'#') !== 0)
545
+            if ($link != '' && strpos($link, '#') !== 0)
546 546
             {
547 547
                 $link = parse_url($link);
548 548
 
549
-                if(!isset($link['scheme']))
549
+                if (!isset($link['scheme']))
550 550
                 {
551 551
                     $link['scheme'] = $this->data['parsed_url']['scheme'];
552 552
                 }
553 553
 
554
-                if(!isset($link['host']))
554
+                if (!isset($link['host']))
555 555
                 {
556 556
                     $link['host'] = $this->data['parsed_url']['host'];
557 557
                 }
558 558
 
559
-                if(!isset($link['path']))
559
+                if (!isset($link['path']))
560 560
                 {
561 561
                     $link['path'] = '';
562 562
                 } else {
563
-                    if(strpos($link['path'],'/') === false)
563
+                    if (strpos($link['path'], '/') === false)
564 564
                     {
565 565
                         $link['path'] = '/'.$link['path'];
566 566
                     }
567 567
                 }
568 568
 
569
-                if(!isset($link['query']))
569
+                if (!isset($link['query']))
570 570
                 {
571 571
                     $link['query'] = '';
572 572
                 } else {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         $tags   = $dom->getElementsByTagName('style');
602 602
         $output = array();
603 603
 
604
-        foreach($tags as $item)
604
+        foreach ($tags as $item)
605 605
         {
606 606
             $output[] = $this->helpers->Whitespace($item->textContent);
607 607
         }
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         foreach ($tags as $tag)
624 624
         {
625 625
             $content = $tag->getAttribute('content');
626
-            if(strtolower($tag->getAttribute('name')) == 'description' && strlen($content) > 0)
626
+            if (strtolower($tag->getAttribute('name')) == 'description' && strlen($content) > 0)
627 627
             {
628 628
                 $output = $content;
629 629
             }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
         $output = '';
646 646
         foreach ($tags as $tag)
647 647
         {
648
-            if(isset($tag->nodeValue) && strlen($tag->nodeValue) > 0)
648
+            if (isset($tag->nodeValue) && strlen($tag->nodeValue) > 0)
649 649
             {
650 650
                 $output = $tag->nodeValue;
651 651
             }
@@ -670,13 +670,13 @@  discard block
 block discarded – undo
670 670
         $output = array();
671 671
         foreach ($tags as $tag)
672 672
         {
673
-            if($tag->getAttribute('name') == 'robots')
673
+            if ($tag->getAttribute('name') == 'robots')
674 674
             {
675 675
                 $output[] = $tag->getAttribute('content');
676 676
             }
677 677
         }
678 678
 
679
-        return $this->Output(in_array('nofollow',$output), __FUNCTION__);
679
+        return $this->Output(in_array('nofollow', $output), __FUNCTION__);
680 680
     }
681 681
 
682 682
     /**
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
         $output = array();
694 694
         foreach ($tags as $tag)
695 695
         {
696
-            if($tag->getAttribute('name') == 'robots')
696
+            if ($tag->getAttribute('name') == 'robots')
697 697
             {
698 698
                 $output[] = $tag->getAttribute('content');
699 699
             }
700 700
         }
701 701
 
702
-        return $this->Output(in_array('noindex',$output), __FUNCTION__);
702
+        return $this->Output(in_array('noindex', $output), __FUNCTION__);
703 703
     }
704 704
 
705 705
     /**
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
     {
712 712
         $output               = array();
713 713
 
714
-        $output['actual']     = round(strlen($this->data['content']) / 1024,2);
714
+        $output['actual']     = round(strlen($this->data['content']) / 1024, 2);
715 715
         $output['possible']   = gzcompress($this->data['content'], 9);
716
-        $output['possible']   = round(strlen($output['possible']) / 1024,2);
717
-        $output['percentage'] = round((($output['possible'] * 100) / $output['actual']),2);
718
-        $output['difference'] = round($output['actual'] - $output['possible'],2);
716
+        $output['possible']   = round(strlen($output['possible']) / 1024, 2);
717
+        $output['percentage'] = round((($output['possible'] * 100) / $output['actual']), 2);
718
+        $output['difference'] = round($output['actual'] - $output['possible'], 2);
719 719
 
720 720
         return $this->Output($output, __FUNCTION__);
721 721
     }
Please login to merge, or discard this patch.