1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DevBoardLib\GithubObjectApiFacade\Repo; |
4
|
|
|
|
5
|
|
|
use DevBoardLib\GithubApiFacade\Auth\GithubAccessToken; |
6
|
|
|
use DevBoardLib\GithubApiFacade\Repo\RepoFacadeFactory as WrappedRepoFacadeFactory; |
7
|
|
|
use DevBoardLib\GithubCore\Repo\GithubRepo; |
8
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\Branch\Converter\GithubBranchConverter; |
9
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\Commit\Converter\GithubCommitConverter; |
10
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\CommitStatus\Converter\GithubCommitStatusConverter; |
11
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\Issue\Converter\GithubIssueConverter; |
12
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter\GithubMilestoneConverter; |
13
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\PullRequest\Converter\GithubPullRequestConverter; |
14
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\Repo\Converter\GithubRepoConverter; |
15
|
|
|
use DevBoardLib\GithubObjectApiFacade\Repo\Tag\Converter\GithubTagConverter; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class RepoFacadeFactory. |
19
|
|
|
* |
20
|
|
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
21
|
|
|
*/ |
22
|
|
|
class RepoFacadeFactory |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var WrappedRepoFacadeFactory |
26
|
|
|
*/ |
27
|
|
|
private $wrappedRepoFacadeFactory; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* RepoFacadeFactory constructor. |
31
|
|
|
* |
32
|
|
|
* @param $wrappedRepoFacadeFactory |
33
|
|
|
*/ |
34
|
|
|
public function __construct(WrappedRepoFacadeFactory $wrappedRepoFacadeFactory) |
35
|
|
|
{ |
36
|
|
|
$this->wrappedRepoFacadeFactory = $wrappedRepoFacadeFactory; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param GithubRepo $githubRepo |
41
|
|
|
* @param GithubAccessToken $user |
42
|
|
|
* |
43
|
|
|
* @return SimpleRepoFacade |
44
|
|
|
*/ |
45
|
|
|
public function create(GithubRepo $githubRepo, GithubAccessToken $user) |
46
|
|
|
{ |
47
|
|
|
return new SimpleRepoFacade( |
48
|
|
|
$this->wrappedRepoFacadeFactory->create($githubRepo, $user), |
49
|
|
|
new GithubRepoConverter(), |
50
|
|
|
new GithubBranchConverter($githubRepo), |
51
|
|
|
new GithubTagConverter($githubRepo), |
52
|
|
|
new GithubPullRequestConverter($githubRepo), |
53
|
|
|
new GithubCommitConverter($githubRepo), |
54
|
|
|
new GithubCommitStatusConverter($githubRepo), |
55
|
|
|
new GithubIssueConverter($githubRepo), |
56
|
|
|
new GithubMilestoneConverter($githubRepo) |
57
|
|
|
); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|