mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2026-01-25 16:02:19 +01:00
27 lines
574 B
PHP
27 lines
574 B
PHP
<?php
|
|
|
|
abstract class AbstractSQLRewriter
|
|
{
|
|
protected string $originalSQL;
|
|
|
|
public function __construct(string $sql)
|
|
{
|
|
$this->originalSQL = $sql;
|
|
}
|
|
|
|
abstract public function rewrite(): string;
|
|
|
|
public function original(): string
|
|
{
|
|
return $this->originalSQL;
|
|
}
|
|
|
|
public function type(): string
|
|
{
|
|
// Get the called class name and remove the "SQLRewriter" suffix to get the SQL type
|
|
$className = get_called_class();
|
|
$type = str_replace('SQLRewriter', '', $className);
|
|
return $type;
|
|
}
|
|
}
|