Skip to content

Commit 9db1fd2

Browse files
committed
set properties of solutions via constructor parameters instead of setters, introduce FilePathType enum
1 parent 040fb42 commit 9db1fd2

File tree

54 files changed

+237
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+237
-124
lines changed

src/Analysis/Problem/Bukkit/AmbiguousPluginNameProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function setMatches(array $matches, mixed $patternKey): void
6464
$this->firstPluginPath = $this->correctPluginPath($matches[2]);
6565
$this->secondPluginPath = $this->correctPluginPath($matches[3]);
6666

67-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getFirstPluginPath()));
68-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getSecondPluginPath()));
67+
$this->addSolution(new FileDeleteSolution($this->getFirstPluginPath()));
68+
$this->addSolution(new FileDeleteSolution($this->getSecondPluginPath()));
6969
}
7070

7171
/**

src/Analysis/Problem/Bukkit/ChunkLoadExceptionProblem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public static function getPatterns(): array
5050
*/
5151
public function setMatches(array $matches, mixed $patternKey): void
5252
{
53-
$this->addSolution((new WorldRepairSolution())->setWorldName("world"));
54-
$this->addSolution((new FileDeleteSolution())->setRelativePath("world"));
55-
$this->addSolution((new ChunkRemoveSolution()));
53+
$this->addSolution(new WorldRepairSolution("world"));
54+
$this->addSolution(new FileDeleteSolution("world"));
55+
$this->addSolution(new ChunkRemoveSolution());
5656
}
5757
}

src/Analysis/Problem/Bukkit/Plugin/AuthMeShutdownProblem.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public static function getPatterns(): array
4646
*/
4747
public function setMatches(array $matches, mixed $patternKey): void
4848
{
49-
$this->addSolution((new AuthMeShutdownSolution()));
50-
$this->addSolution((new PluginConfigureSolution())->setPluginName("AuthMe")->setSuggestedFile("plugins/AuthMe/config.yml"));
51-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName("AuthMe"));
52-
$this->addSolution((new PluginRemoveSolution())->setPluginName("AuthMe"));
49+
$this->addSolution(new AuthMeShutdownSolution());
50+
$this->addSolution(new PluginConfigureSolution("AuthMe", "plugins/AuthMe/config.yml"));
51+
$this->addSolution(new PluginInstallDifferentVersionSolution("AuthMe"));
52+
$this->addSolution(new PluginRemoveSolution("AuthMe"));
5353
}
5454
}

src/Analysis/Problem/Bukkit/Plugin/MultiverseLoadProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function setMatches(array $matches, mixed $patternKey): void
5656
{
5757
$this->worldName = $matches[1];
5858

59-
$this->addSolution((new WorldRepairSolution())->setWorldName($this->getWorldName()));
60-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getWorldName()));
59+
$this->addSolution(new WorldRepairSolution($this->getWorldName()));
60+
$this->addSolution(new FileDeleteSolution($this->getWorldName()));
6161
}
6262
}

src/Analysis/Problem/Bukkit/Plugin/PermissionsExConfigProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function getPatterns(): array
4444
*/
4545
public function setMatches(array $matches, mixed $patternKey): void
4646
{
47-
$this->addSolution((new PluginConfigureSolution())->setPluginName("PermissionsEx")->setSuggestedFile("plugins/PermissionsEx/permissions.yml"));
48-
$this->addSolution((new PluginRemoveSolution())->setPluginName("PermissionsEx"));
47+
$this->addSolution(new PluginConfigureSolution("PermissionsEx", "plugins/PermissionsEx/permissions.yml"));
48+
$this->addSolution(new PluginRemoveSolution("PermissionsEx"));
4949
}
5050
}

src/Analysis/Problem/Bukkit/PluginCommandExceptionProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public function setMatches(array $matches, mixed $patternKey): void
5151
$this->command = $matches[1];
5252
$this->pluginName = $matches[2];
5353

54-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
55-
$this->addSolution((new PluginRemoveSolution())->setPluginName($this->getPluginName()));
54+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
55+
$this->addSolution(new PluginRemoveSolution($this->getPluginName()));
5656
}
5757

5858
/**

src/Analysis/Problem/Bukkit/PluginDependenciesProblem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ public function setMatches(array $matches, mixed $patternKey): void
8888
if ($matches[4]) {
8989
$this->pluginName = $matches[4];
9090
$this->pluginFilePath = $this->correctPluginPath($matches[1]);
91-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
92-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
91+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
92+
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
9393
} else {
9494
parent::setMatches($matches, $patternKey);
9595
}
9696

9797
$this->dependencyPluginNames = preg_split("/, ?/", $matches[3]);
9898
foreach ($this->dependencyPluginNames as $name) {
99-
$this->addSolution((new PluginInstallSolution())->setPluginName($name));
99+
$this->addSolution(new PluginInstallSolution($name));
100100
}
101101
}
102102

src/Analysis/Problem/Bukkit/PluginDependencyProblem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function setMatches(array $matches, mixed $patternKey): void
6262
parent::setMatches($matches, $patternKey);
6363

6464
$this->dependencyPluginName = $matches[3] ?: $matches[4];
65-
$this->addSolution((new PluginInstallSolution())->setPluginName($this->getDependencyPluginName()));
65+
$this->addSolution(new PluginInstallSolution($this->getDependencyPluginName()));
6666
}
6767

6868
/**

src/Analysis/Problem/Bukkit/PluginFileProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public function setMatches(array $matches, mixed $patternKey): void
4545
$this->pluginFilePath = $folderPath . '/' . $pluginFileName;
4646
$this->pluginName = $this->extractPluginName($matches[1]);
4747

48-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
49-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
48+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
49+
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
5050
}
5151

5252
/**

src/Analysis/Problem/Bukkit/PluginProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function setMatches(array $matches, mixed $patternKey): void
4141
{
4242
$this->pluginName = $this->extractPluginName($matches[1]);
4343

44-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
45-
$this->addSolution((new PluginRemoveSolution())->setPluginName($this->getPluginName()));
44+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
45+
$this->addSolution(new PluginRemoveSolution($this->getPluginName()));
4646
}
4747

4848
/**

0 commit comments

Comments
 (0)