@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | $projectInfo = json_decode(file_get_contents($projectDir . 'composer.json'), true); |
45 | - if (!isset($projectInfo['autoload']['psr-4'])) { |
|
45 | + if (!isset($projectInfo['autoload']['psr-4'])) { |
|
46 | 46 | printf("No supported autoload configuration in %s" . PHP_EOL, $projectDir); |
47 | 47 | exit(2); |
48 | 48 | } |
@@ -51,43 +51,43 @@ discard block |
||
51 | 51 | $namespace = str_replace($stripNamespacePrefix, '', $namespace); |
52 | 52 | } |
53 | 53 | $destination = rtrim($sourceDirectory, '/') . str_replace('\\', '/', $namespace); |
54 | - $destinations = insertion_sort($destinations, [ |
|
55 | - "destination"=>$destination, |
|
56 | - "codeDir"=>$codeDir, |
|
57 | - "projectDir"=>$projectDir, |
|
58 | - ]); |
|
59 | - } |
|
54 | + $destinations = insertion_sort($destinations, [ |
|
55 | + "destination"=>$destination, |
|
56 | + "codeDir"=>$codeDir, |
|
57 | + "projectDir"=>$projectDir, |
|
58 | + ]); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | foreach ($destinations as $item) { |
63 | - $destination = $item["destination"]; |
|
64 | - $codeDir = $item["codeDir"]; |
|
65 | - $projectDir = $item["projectDir"]; |
|
66 | - |
|
67 | - if (file_exists($destination)) { |
|
68 | - rmdir_recursive($destination); |
|
69 | - } |
|
70 | - mkdir($destination, 0777, true); |
|
71 | - |
|
72 | - if (!rename_or_move($projectDir . $codeDir, $destination)) { |
|
73 | - printf("Failed to move %s to %s" . PHP_EOL, $projectDir . $codeDir, $destination); |
|
74 | - exit(3); |
|
75 | - } |
|
63 | + $destination = $item["destination"]; |
|
64 | + $codeDir = $item["codeDir"]; |
|
65 | + $projectDir = $item["projectDir"]; |
|
66 | + |
|
67 | + if (file_exists($destination)) { |
|
68 | + rmdir_recursive($destination); |
|
69 | + } |
|
70 | + mkdir($destination, 0777, true); |
|
71 | + |
|
72 | + if (!rename_or_move($projectDir . $codeDir, $destination)) { |
|
73 | + printf("Failed to move %s to %s" . PHP_EOL, $projectDir . $codeDir, $destination); |
|
74 | + exit(3); |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | function insertion_sort($array, $element): array |
79 | 79 | { |
80 | - for($i = 0; $i < count($array); $i++) { |
|
81 | - $compare = strcmp($array[$i]["destination"], $element["destination"]); |
|
82 | - if($compare > 0) { |
|
83 | - array_splice($array, $i, 0, [$element]); |
|
84 | - return $array; |
|
85 | - }else if($compare == 0){ |
|
86 | - return $array; |
|
87 | - } |
|
88 | - } |
|
89 | - $array[] = $element; |
|
90 | - return $array; |
|
80 | + for($i = 0; $i < count($array); $i++) { |
|
81 | + $compare = strcmp($array[$i]["destination"], $element["destination"]); |
|
82 | + if($compare > 0) { |
|
83 | + array_splice($array, $i, 0, [$element]); |
|
84 | + return $array; |
|
85 | + }else if($compare == 0){ |
|
86 | + return $array; |
|
87 | + } |
|
88 | + } |
|
89 | + $array[] = $element; |
|
90 | + return $array; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | foreach($organizationList as $organizationDir) { |