Completed
Push — master ( edf8cc...f83cc8 )
by Miro
02:37
created

tests/SampleDataProvider.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace tests\DevBoardLib\GithubObjectApiFacade;
4
5
/**
6
 * Class SampleDataProvider.
7
 */
8
class SampleDataProvider
9
{
10
    const DEFAULT_REPO       = 'devboard/test-hitman';
11
    const DEFAULT_BRANCH     = 'master';
12
    const DEFAULT_COMMIT_SHA = 'db911bd3a3dd8bb2ad9eccbcb0a396595a51491d';
13
14
    /**
15
     * @return array
16
     */
17
    public function getRepos()
18
    {
19
        return $this->getMyRepositoriesAll();
20
    }
21
22
    /**
23
     * @return mixed
24
     */
25
    public function getRepoDetails($fullName = self::DEFAULT_REPO)
26
    {
27
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/repo-details.json');
28
29
        return json_decode($content, true);
30
    }
31
32
    /**
33
     * @return mixed
34
     */
35
    public function getBranch($fullName = self::DEFAULT_REPO, $branchName = self::DEFAULT_BRANCH)
36
    {
37
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/branch-'.$branchName.'.json');
38
39
        return json_decode($content, true);
40
    }
41
42
    /**
43
     * @return mixed
44
     */
45
    public function getAllBranches($fullName = self::DEFAULT_REPO)
46
    {
47
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/branches.json');
48
49
        return json_decode($content, true);
50
    }
51
52
    /**
53
     * @return mixed
54
     */
55
    public function getAllBranchNames($fullName = self::DEFAULT_REPO)
56
    {
57
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/branchnames.json');
58
59
        return json_decode($content, true);
60
    }
61
62
    /**
63
     * @return mixed
64
     */
65
    public function getAllTagNames($fullName = self::DEFAULT_REPO)
66
    {
67
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/tags.json');
68
69
        return json_decode($content, true);
70
    }
71
72
    /**
73
     * @return mixed
74
     */
75 View Code Duplication
    public function getCommit($fullName = self::DEFAULT_REPO, $commitSha = self::DEFAULT_COMMIT_SHA)
0 ignored issues
show
This method 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...
76
    {
77
        $content = file_get_contents(
78
            __DIR__.'/sample-data/'.$fullName.'/commit-'.$commitSha.'.json'
79
        );
80
81
        return json_decode($content, true);
82
    }
83
84
    /**
85
     * @return mixed
86
     */
87 View Code Duplication
    public function getCommitStatus($fullName = self::DEFAULT_REPO, $commitSha = self::DEFAULT_COMMIT_SHA)
0 ignored issues
show
This method 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...
88
    {
89
        $content = file_get_contents(
90
            __DIR__.'/sample-data/'.$fullName.'/commit_status-'.$commitSha.'.json'
91
        );
92
93
        return json_decode($content, true);
94
    }
95
96
    /**
97
     * @return mixed
98
     */
99 View Code Duplication
    public function getCommitStatuses($fullName = self::DEFAULT_REPO, $commitSha = self::DEFAULT_COMMIT_SHA)
0 ignored issues
show
This method 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...
100
    {
101
        $content = file_get_contents(
102
            __DIR__.'/sample-data/'.$fullName.'/commit_statuses-'.$commitSha.'.json'
103
        );
104
105
        return json_decode($content, true);
106
    }
107
108
    /**
109
     * @return mixed
110
     */
111
    public function getAllPullRequests($fullName = self::DEFAULT_REPO)
112
    {
113
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/pullrequests.json');
114
115
        return json_decode($content, true);
116
    }
117
118
    /**
119
     * @return mixed
120
     */
121
    public function getAllMilestones($fullName = self::DEFAULT_REPO)
122
    {
123
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/milestones.json');
124
125
        return json_decode($content, true);
126
    }
127
128
    /**
129
     * @return mixed
130
     */
131
    public function getAllIssues($fullName = self::DEFAULT_REPO)
132
    {
133
        $content = file_get_contents(__DIR__.'/sample-data/'.$fullName.'/issues.json');
134
135
        return json_decode($content, true);
136
    }
137
138
    /**
139
     * @return mixed
140
     */
141
    public function getMyRepositoriesAll()
142
    {
143
        $content = file_get_contents(__DIR__.'/sample-data/me/repositories/all.json');
144
145
        return json_decode($content, true);
146
    }
147
}
148