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.

WordPressUrlGenerator   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 91.67%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 40
ccs 11
cts 12
cp 0.9167
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 4 1
A generateCompareUrl() 0 16 3
A generateReleaseUrl() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the composer-changelogs project.
5
 *
6
 * (c) Loïck Piera <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Pyrech\ComposerChangelogs\UrlGenerator;
13
14
use Pyrech\ComposerChangelogs\Version;
15
16
/**
17
 * @author Sullivan Senechal <[email protected]>
18
 */
19
class WordPressUrlGenerator implements UrlGenerator
20
{
21
    const DOMAIN = 'svn.wordpress.org';
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 4
    public function supports($sourceUrl)
27
    {
28 4
        return strpos($sourceUrl, self::DOMAIN) !== false;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 2
    public function generateCompareUrl($sourceUrlFrom, Version $versionFrom, $sourceUrlTo, Version $versionTo)
35
    {
36 2
        if (preg_match('#plugins.svn.wordpress.org/(.*)/#', $sourceUrlTo, $matches)) {
37 2
            $plugin = $matches[1];
38
39 2
            return sprintf('https://wordpress.org/plugins/%s/changelog/', $plugin);
40
        }
41
42 2
        if (preg_match('#themes.svn.wordpress.org/(.*)/#', $sourceUrlTo, $matches)) {
43 2
            $theme = $matches[1];
44
45 2
            return sprintf('https://themes.trac.wordpress.org/log/%s/', $theme);
46
        }
47
48
        return false;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 2
    public function generateReleaseUrl($sourceUrl, Version $version)
55
    {
56 2
        return false;
57
    }
58
}
59