Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
StarterFileService | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
publish | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
publishFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Hyde\Framework\Services; |
4 | |
5 | use Hyde\Framework\Hyde; |
6 | |
7 | /** |
8 | * Manage the content files that should be included in Hyde/Hyde installations. |
9 | * |
10 | * @deprecated 0.20.x-dev This is managed by a CI action that keeps Hyde/Hyde up to date. |
11 | */ |
12 | class StarterFileService |
13 | { |
14 | /** |
15 | * Mapping of the source file to the destination file. |
16 | * ['vendorPath' => 'hydePath']. |
17 | */ |
18 | public static array $files = [ |
19 | 'resources/views/homepages/welcome.blade.php' => '_pages/index.blade.php', |
20 | 'resources/views/pages/404.blade.php' => '_pages/404.blade.php', |
21 | ]; |
22 | |
23 | /** |
24 | * Publish all the starter files. |
25 | */ |
26 | public static function publish(): void |
27 | { |
28 | $files = static::$files; |
29 | foreach ($files as $source => $file) { |
30 | static::publishFile($source, $file); |
31 | } |
32 | } |
33 | |
34 | /** |
35 | * Publish a single starter file. |
36 | */ |
37 | protected static function publishFile(string $from, string $to): void |
38 | { |
39 | Hyde::copy(Hyde::vendorPath($from), Hyde::path($to)); |
40 | } |
41 | } |