1 | <?php |
||
14 | class TemplateListFactory |
||
15 | { |
||
16 | /** |
||
17 | * @param string $repositoryType |
||
18 | * @param string $repositorySubType |
||
19 | * |
||
20 | * @return Template[] |
||
21 | */ |
||
22 | public function create($repositoryType, $repositorySubType) |
||
23 | { |
||
24 | $templateList = $this->getTemplateList($repositoryType); |
||
25 | |||
26 | (new NamespaceResolver())->resolve($templateList, $repositoryType, $repositorySubType); |
||
27 | |||
28 | // Reorder final list |
||
29 | $orderedList = [ |
||
30 | 'git.readme', |
||
31 | 'git.license', |
||
32 | 'git.contributing', |
||
33 | 'git.gitignore', |
||
34 | 'composer.config', |
||
35 | 'phpcs.config', |
||
36 | 'phpunit.config', |
||
37 | 'phpunit.folders', |
||
38 | 'behat.config', |
||
39 | 'behat.folders', |
||
40 | 'ci.scrutinizer', |
||
41 | 'ci.travis', |
||
42 | ]; |
||
43 | |||
44 | $finalList = []; |
||
45 | foreach ($orderedList as $key) { |
||
46 | if (isset($templateList[$key])) { |
||
47 | $finalList[$key] = $templateList[$key]; |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return $finalList; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @param string $id |
||
56 | * @param string $templateName |
||
57 | * |
||
58 | * @return Template |
||
59 | */ |
||
60 | protected function createTemplate($id, $templateName) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * @param string $templateName |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | protected function getOutputFilePath($templateName) |
||
75 | |||
76 | /** |
||
77 | * @param $repositoryType |
||
78 | * @return array |
||
79 | */ |
||
80 | protected function getTemplateList($repositoryType) |
||
127 | } |
||
128 |