Add ModMissingProblem and ModMissingSolution
This commit is contained in:
39
src/Analysis/ProjectZomboid/ModMissingProblem.php
Normal file
39
src/Analysis/ProjectZomboid/ModMissingProblem.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace IndifferentKetchup\Codex\Analysis\ProjectZomboid;
|
||||
|
||||
use IndifferentKetchup\Codex\Analysis\InsightInterface;
|
||||
use IndifferentKetchup\Codex\Analysis\PatternInsightInterface;
|
||||
use IndifferentKetchup\Codex\Analysis\Problem;
|
||||
use IndifferentKetchup\Codex\Pattern\ProjectZomboid\DebugServerPattern;
|
||||
|
||||
class ModMissingProblem extends Problem implements PatternInsightInterface
|
||||
{
|
||||
private string $modName = '';
|
||||
|
||||
public static function getPatterns(): array
|
||||
{
|
||||
return [DebugServerPattern::MOD_MISSING];
|
||||
}
|
||||
|
||||
public function setMatches(array $matches, mixed $patternKey): void
|
||||
{
|
||||
$this->modName = $matches['mod'];
|
||||
$this->addSolution((new ModMissingSolution())->setModName($this->modName));
|
||||
}
|
||||
|
||||
public function getModName(): string
|
||||
{
|
||||
return $this->modName;
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
return sprintf('Required mod "%s" not found.', $this->modName);
|
||||
}
|
||||
|
||||
public function isEqual(InsightInterface $insight): bool
|
||||
{
|
||||
return $insight instanceof self && $insight->getModName() === $this->modName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user