1010namespace Youwe \CodingStandard \PhpStorm \Patcher ;
1111
1212use Youwe \CodingStandard \PhpStorm \FilesystemInterface ;
13+ use Youwe \CodingStandard \PhpStorm \ProjectTypeResolver ;
1314
1415trait CopyFilesTrait
1516{
@@ -19,15 +20,17 @@ trait CopyFilesTrait
1920 * @param FilesystemInterface $source
2021 * @param FilesystemInterface $destination
2122 * @param string $path
23+ * @param string $type
2224 *
2325 * @return void
2426 */
2527 private function copyDirectory (
2628 FilesystemInterface $ source ,
2729 FilesystemInterface $ destination ,
28- string $ path
30+ string $ path ,
31+ string $ type = ProjectTypeResolver::DEFAULT_PROJECT_TYPE
2932 ): void {
30- foreach ($ source ->listFiles ($ path ) as $ filePath ) {
33+ foreach ($ source ->listFiles ($ type . DIRECTORY_SEPARATOR . $ path ) as $ filePath ) {
3134 $ this ->copyFile ($ source , $ destination , $ filePath );
3235 }
3336 }
@@ -38,17 +41,21 @@ private function copyDirectory(
3841 * @param FilesystemInterface $source
3942 * @param FilesystemInterface $destination
4043 * @param string $path
44+ * @param string $type
4145 *
4246 * @return void
4347 */
4448 private function copyFile (
4549 FilesystemInterface $ source ,
4650 FilesystemInterface $ destination ,
47- string $ path
51+ string $ path ,
52+ string $ type = ProjectTypeResolver::DEFAULT_PROJECT_TYPE
4853 ): void {
54+ $ projectPath = $ type . DIRECTORY_SEPARATOR . $ path ;
55+
4956 $ destination ->put (
50- $ path ,
51- $ source ->read ($ path )
57+ $ projectPath ,
58+ $ source ->read ($ projectPath )
5259 );
5360 }
5461}
0 commit comments