mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 14:24:04 +00:00
Improve code quality and comments
This commit is contained in:
parent
26c161a940
commit
429e0985fd
2 changed files with 4 additions and 7 deletions
|
|
@ -20,7 +20,7 @@ trait ValidatesDatabaseParameters
|
|||
/**
|
||||
* Characters allowed in parameters.
|
||||
*
|
||||
* Used as the default allowlist for validateParameter(), which validates non-password
|
||||
* Used as the default allowlist in validateParameter(), which validates non-password
|
||||
* parameters such as database names or usernames.
|
||||
*/
|
||||
protected static function allowedParameterCharacters(): string
|
||||
|
|
@ -44,7 +44,7 @@ trait ValidatesDatabaseParameters
|
|||
/**
|
||||
* Ensure that parameters (database names, usernames, etc.)
|
||||
* only contain allowed characters before used in SQL statements
|
||||
* (or file names in the case of SQLiteDatabaseManager).
|
||||
* (or paths in the case of SQLiteDatabaseManager).
|
||||
*
|
||||
* By default, only the characters in static::allowedParameterCharacters() are allowed.
|
||||
*
|
||||
|
|
@ -65,6 +65,7 @@ trait ValidatesDatabaseParameters
|
|||
}
|
||||
|
||||
if (! is_string($parameter)) {
|
||||
// E.g. if a parameter is retrieved from the config, it isn't necessarily a string
|
||||
throw new InvalidArgumentException('Parameter has to be a string.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,11 +130,7 @@ class SQLiteDatabaseManager implements TenantDatabaseManager
|
|||
|
||||
public function databaseExists(string $name): bool
|
||||
{
|
||||
if ($this->isInMemory($name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return file_exists($this->getPath($name));
|
||||
return $this->isInMemory($name) || file_exists($this->getPath($name));
|
||||
}
|
||||
|
||||
public function makeConnectionConfig(array $baseConfig, string $databaseName): array
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue