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