Constructor pre-registers every concrete ProjectZomboid Log subclass so that detect() can dispatch on filename hint plus content signature. Data-provider test verifies each of the eleven synthetic fixtures resolves to its expected Log class via the public Detective surface.
39 lines
1.9 KiB
PHP
39 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace IndifferentKetchup\Codex\Detective\ProjectZomboid;
|
|
|
|
use IndifferentKetchup\Codex\Detective\Detective;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidAdminLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidBurdJournalsLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidChatLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidClientActionLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidCmdLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidItemLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidMapLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidPerkLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidPvpLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidServerLog;
|
|
use IndifferentKetchup\Codex\Log\ProjectZomboid\ProjectZomboidUserLog;
|
|
|
|
/**
|
|
* Pre-registers all eleven ProjectZomboid log classes so that detect()
|
|
* can dispatch among them on filename hint + content signature.
|
|
*/
|
|
class ProjectZomboidDetective extends Detective
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->addPossibleLogClass(ProjectZomboidServerLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidChatLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidClientActionLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidCmdLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidItemLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidMapLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidPerkLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidPvpLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidAdminLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidUserLog::class);
|
|
$this->addPossibleLogClass(ProjectZomboidBurdJournalsLog::class);
|
|
}
|
|
}
|