Sitemap   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSitemapFromRobotsTxt() 0 7 1
1
<?php
2
/**
3
 * Mage Scan
4
 *
5
 * PHP version 5
6
 *
7
 * @category  MageScan
8
 * @package   MageScan
9
 * @author    Steve Robbins <[email protected]>
10
 * @copyright 2015 Steve Robbins
11
 * @license   http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
12
 * @link      https://github.com/steverobbins/magescan
13
 */
14
15
namespace MageScan\Check;
16
17
use GuzzleHttp\Psr7\Response;
18
use MageScan\Request;
19
20
/**
21
 * Parse a sitemap
22
 *
23
 * @category  MageScan
24
 * @package   MageScan
25
 * @author    Steve Robbins <[email protected]>
26
 * @copyright 2015 Steve Robbins
27
 * @license   http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
28
 * @link      https://github.com/steverobbins/magescan
29
 */
30
class Sitemap extends AbstractCheck
31
{
32
    /**
33
     * Parse the sitemap url out of a robots.txt contents
34
     *
35
     * @param Response $response
36
     *
37
     * @return string|boolean
38
     */
39
    public function getSitemapFromRobotsTxt(Response $response)
40
    {
41
        return $this->getRequest()->findMatchInResponse(
42
            $response->getBody()->getContents(),
43
            '/^(?!#+)\s*Sitemap:\s+(.*)$/mi'
44
        );
45
    }
46
}
47