for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Phuria\SQLBuilder;
/**
* This file is part of Phuria SQL Builder package.
*
* Copyright (c) 2016 Beniamin Jonatan Šimko
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Phuria\SQLBuilder\Table\UnknownTable;
* @author Beniamin Jonatan Šimko <[email protected]>
class TableRegistry
{
* @var array $tables
private $tableNameMap = [];
* @var array $tableClassMap
private $tableClassMap = [];
* @param string $tableClass
* @param string $tableName
* @return $this
public function registerTable($tableClass, $tableName)
$this->tableClassMap[$tableClass] = $tableName;
$this->tableNameMap[$tableName] = $tableClass;
return $this;
}
* @return string
public function getTableClass($tableName)
if (false === array_key_exists($tableName, $this->tableNameMap)) {
return UnknownTable::class;
return $this->tableNameMap[$tableName];