Pages   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getInformation() 5 5 1
A listPagesBuilds() 5 5 1
A listLatestPagesBuilds() 5 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace FlexyProject\GitHub\Receiver\Repositories;
3
4
/**
5
 * The Pages API class provides access to repository's pages.
6
 *
7
 * @link    https://developer.github.com/v3/repos/pages/
8
 * @package FlexyProject\GitHub\Receiver\Repositories
9
 */
10 View Code Duplication
class Pages extends AbstractRepositories
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
13
    /**
14
     * Get information about a Pages site
15
     *
16
     * @link https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site
17
     * @return array
18
     */
19
    public function getInformation(): array
20
    {
21
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages',
22
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
23
    }
24
25
    /**
26
     * List Pages builds
27
     *
28
     * @link https://developer.github.com/v3/repos/pages/#list-pages-builds
29
     * @return array
30
     */
31
    public function listPagesBuilds(): array
32
    {
33
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds',
34
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
35
    }
36
37
    /**
38
     * List latest Pages build
39
     *
40
     * @link https://developer.github.com/v3/repos/pages/#list-latest-pages-build
41
     * @return array
42
     */
43
    public function listLatestPagesBuilds(): array
44
    {
45
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds/latest',
46
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
47
    }
48
}