Resolved table name => observed present. */ private $observedPresent = array(); /** * @param ABJ_404_Solution_DatabaseQueryInterface $dbCore Supplies table-name replacement. * @param ABJ_404_Solution_DatabaseTableNameResolver $tableNameResolver Runs the probe. */ public function __construct( ABJ_404_Solution_DatabaseQueryInterface $dbCore, ABJ_404_Solution_DatabaseTableNameResolver $tableNameResolver ) { $this->dbCore = $dbCore; $this->tableNameResolver = $tableNameResolver; } /** * Whether the engine positively reported this table as not existing. * * Asked in the negative on purpose, so that the answer a caller acts on is * the only one that is safe to act on. False means "not known to be * absent", which covers both a table that is there and a probe that could * not be answered -- in both cases the caller should do its work. * * @param string $tableToken Unresolved token, e.g. '{wp_abj404_redirects}'. */ public function isKnownAbsent(string $tableToken): bool { $table = $this->dbCore->doTableNameReplacements($tableToken); if (!empty($this->observedPresent[$table])) { return false; } $status = $this->tableNameResolver->tableExistenceStatus($table); if ($status === ABJ_404_Solution_DatabaseTableNameResolver::TABLE_PRESENT) { $this->observedPresent[$table] = true; return false; } return $status === ABJ_404_Solution_DatabaseTableNameResolver::TABLE_ABSENT; } }