GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#7)
by
unknown
01:08
created

GoogleSitemapFactory::instantiateNewSitemap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Tackk\Cartographer;
4
5
use ArrayObject;
6
use DateTime;
7
use Iterator;
8
use League\Flysystem\FilesystemInterface;
9
use RuntimeException;
10
11
class GoogleSitemapFactory extends SitemapFactory
12
{
13
14
    /**
15
     * @return GoogleSitemap
16
     */
17
    protected function instantiateNewSitemap()
18
    {
19
        return new GoogleSitemap();
20
    }
21
22
    protected function addEntry($entry, AbstractSitemap $sitemap)
23
    {
24
        if (!$sitemap instanceof GoogleSitemap) {
25
            throw new \Exception('Bad sitemap type. Must be a google site map instance');
26
        }
27
28
        parent::addEntry($entry, $sitemap);
29
30
        $images = get_property($entry, 'images');
31
32
        if ($images) {
33
            foreach ($images as $image) {
34
35
                $loc        = get_property($image, 'loc');
36
                $title      = get_property($image, 'title');
37
                $caption    = get_property($image, 'caption');
38
                $geo_location = get_property($image, 'geo_location');
39
                $license    = get_property($image, 'license');
40
41
                $sitemap->addImage($loc, $title, $caption, $geo_location, $license);
42
            }
43
        }
44
45
46
    }
47
48
49
50
}
51