/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/bake/src/Utility
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/bake/src/Utility/TableScanner.php (2876B)
connection = $connection;
if ($ignore === null) {
$ignore = ['i18n', 'cake_sessions', 'sessions', '/phinxlog/'];
}
$this->ignore = $ignore;
}
/**
* Get all tables in the connection without applying ignores.
*
* @return string[]
*/
public function listAll(): array
{
$schema = $this->connection->getSchemaCollection();
$tables = $schema->listTables();
if (empty($tables)) {
throw new RuntimeException('Your database does not have any tables.');
}
sort($tables);
return array_combine($tables, $tables);
}
/**
* Get all tables in the connection that aren't ignored.
*
* @return string[]
*/
public function listUnskipped(): array
{
$tables = $this->listAll();
foreach ($tables as $key => $table) {
if ($this->shouldSkip($table)) {
unset($tables[$key]);
}
}
return $tables;
}
/**
* @param string $table Table name.
* @return bool
*/
protected function shouldSkip(string $table): bool
{
foreach ($this->ignore as $ignore) {
if (strpos($ignore, '/') === 0) {
if ((bool)preg_match($ignore, $table)) {
return true;
}
}
if ($ignore === $table) {
return true;
}
}
return false;
}
}