|
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; |
|
13
|
|
|
|
|
14
|
|
|
use Pyrech\ComposerChangelogs\OperationHandler\OperationHandler; |
|
15
|
|
|
use Pyrech\ComposerChangelogs\UrlGenerator\UrlGenerator; |
|
16
|
|
|
|
|
17
|
|
|
class Factory |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @return OperationHandler[] |
|
21
|
|
|
*/ |
|
22
|
10 |
|
public static function createOperationHandlers() |
|
23
|
|
|
{ |
|
24
|
|
|
return [ |
|
25
|
10 |
|
new \Pyrech\ComposerChangelogs\OperationHandler\InstallHandler(), |
|
26
|
10 |
|
new \Pyrech\ComposerChangelogs\OperationHandler\UpdateHandler(), |
|
27
|
10 |
|
new \Pyrech\ComposerChangelogs\OperationHandler\UninstallHandler(), |
|
28
|
10 |
|
]; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @param string[] $gitlabHosts |
|
33
|
|
|
* |
|
34
|
|
|
* @return UrlGenerator[] |
|
35
|
|
|
*/ |
|
36
|
10 |
|
public static function createUrlGenerators(array $gitlabHosts = []) |
|
37
|
|
|
{ |
|
38
|
|
|
$hosts = [ |
|
39
|
10 |
|
new \Pyrech\ComposerChangelogs\UrlGenerator\GithubUrlGenerator(), |
|
40
|
10 |
|
new \Pyrech\ComposerChangelogs\UrlGenerator\BitbucketUrlGenerator(), |
|
41
|
10 |
|
new \Pyrech\ComposerChangelogs\UrlGenerator\WordPressUrlGenerator(), |
|
42
|
10 |
|
]; |
|
43
|
|
|
|
|
44
|
10 |
|
foreach ($gitlabHosts as $gitlabHost) { |
|
45
|
|
|
$hosts[] = new \Pyrech\ComposerChangelogs\UrlGenerator\GitlabUrlGenerator($gitlabHost); |
|
46
|
10 |
|
} |
|
47
|
|
|
|
|
48
|
10 |
|
return $hosts; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @param string[] $gitlabHosts |
|
53
|
|
|
* |
|
54
|
|
|
* @return Outputter |
|
55
|
|
|
*/ |
|
56
|
10 |
|
public static function createOutputter(array $gitlabHosts = []) |
|
57
|
|
|
{ |
|
58
|
10 |
|
return new Outputter( |
|
59
|
10 |
|
self::createOperationHandlers(), |
|
60
|
10 |
|
self::createUrlGenerators($gitlabHosts) |
|
61
|
10 |
|
); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|