Initial import from aternosorg/codex-minecraft
Some checks failed
Tests / Run tests on PHP v8.4 (push) Failing after 32s
Tests / Run tests on PHP v8.5 (push) Failing after 2s

This commit is contained in:
2026-04-30 09:56:57 -05:00
commit 7c7fe5ca80
94 changed files with 7003 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?php
namespace Aternos\Codex\Test\Src\Analysis;
use Aternos\Codex\Analysis\Information;
/**
* Class TestInformation
*/
class TestInformation extends Information
{
protected ?string $label = "Label";
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Aternos\Codex\Test\Src\Analysis;
use Aternos\Codex\Analysis\Insight;
use Aternos\Codex\Analysis\InsightInterface;
/**
* Class TestInsight
*/
class TestInsight extends Insight
{
/**
* Get the insight as human-readable message
*
* @return string
*/
public function getMessage(): string
{
return "This is a test insight";
}
/**
* Check if the $insight object is equal with the current object
*
* @param InsightInterface $insight
* @return bool
*/
public function isEqual(InsightInterface $insight): bool
{
return false;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace Aternos\Codex\Test\Src\Analysis;
use Aternos\Codex\Analysis\Information;
use Aternos\Codex\Analysis\PatternInsightInterface;
/**
* Class TestPatternInformation
*/
class TestPatternInformation extends Information implements PatternInsightInterface
{
protected ?string $label = "Software version";
/**
* Get an array of possible patterns
*
* The array key of the pattern will be passed to setMatches()
*
* @return array
*/
public static function getPatterns(): array
{
return ['/This log was generated by software (v[0-9\.]*)/'];
}
/**
* Apply the matches from the pattern
*
* @param array $matches
* @param mixed $patternKey
* @return void
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->value = $matches[1];
}
public function getLogContent(): ?string
{
return parent::getLogContent();
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace Aternos\Codex\Test\Src\Analysis;
use Aternos\Codex\Analysis\InsightInterface;
use Aternos\Codex\Analysis\PatternInsightInterface;
use Aternos\Codex\Analysis\Problem;
/**
* Class TestPatternProblem
*/
class TestPatternProblem extends Problem implements PatternInsightInterface
{
protected ?string $cause = null;
/**
* @param string $cause
* @return TestPatternProblem
*/
public function setCause(string $cause): static
{
$this->cause = $cause;
return $this;
}
/**
* Get an array of possible patterns
*
* The array key of the pattern will be passed to setMatches()
*
* @return array
*/
public static function getPatterns(): array
{
return ['/I have a problem with (\w+)/'];
}
/**
* Apply the matches from the pattern
*
* @param array $matches
* @param mixed $patternKey
* @return void
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->cause = $matches[1];
}
/**
* Get the problem as human-readable message
*
* @return string
*/
public function getMessage(): string
{
return "There is a problem with " . $this->cause;
}
/**
* Check if the $insight object is equal with the current object
*
* @param InsightInterface $insight
* @return bool
*/
public function isEqual(InsightInterface $insight): bool
{
return $insight instanceof static && $this->cause === $insight->cause;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Aternos\Codex\Test\Src\Analysis;
use Aternos\Codex\Analysis\InsightInterface;
use Aternos\Codex\Analysis\Problem;
/**
* Class TestProblem
*/
class TestProblem extends Problem
{
/**
* Get the problem as human-readable message
*
* @return string
*/
public function getMessage(): string
{
return "This is a test problem";
}
/**
* Check if the $insight object is equal with the current object
*
* @param InsightInterface $insight
* @return bool
*/
public function isEqual(InsightInterface $insight): bool
{
return false;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Aternos\Codex\Test\Src\Analysis;
use Aternos\Codex\Analysis\Solution;
/**
* Class TestSolution
*/
class TestSolution extends Solution
{
/**
* Get the solution as a human-readable message
*
* @return string
*/
public function getMessage(): string
{
return "This is a test solution.";
}
}