public static \Joomla\CMS\Schema\ChangeItem
getInstance
(mixed $db, mixed $file, mixed $query)
/**
* Returns a reference to the ChangeItem object.
*
* @param DatabaseDriver $db Database connector object
* @param string $file Full path name of the sql file
* @param string $query Text of the sql query (one line of the file)
*
* @return ChangeItem instance based on the database driver
*
* @since 2.5
* @throws \RuntimeException if class for database driver not found
*/
public static function getInstance($db, $file, $query)
{
// Get the class name
$serverType = $db->getServerType();
// For `mssql` server types, convert the type to `sqlsrv`
if ($serverType === 'mssql') {
$serverType = 'sqlsrv';
}
$class = '\\Joomla\\CMS\\Schema\\ChangeItem\\' . ucfirst($serverType) . 'ChangeItem';
// If the class exists, return it.
if (class_exists($class)) {
return new $class($db, $file, $query);
}
throw new \RuntimeException(sprintf('ChangeItem child class not found for the %s database driver', $serverType), 500);
}