Moves sql format entry point logic to the SqlFormatController controller and removes the entry point file. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
29 lines
594 B
PHP
29 lines
594 B
PHP
<?php
|
|
/**
|
|
* @package PhpMyAdmin\Controllers\Database
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpMyAdmin\Controllers\Database;
|
|
|
|
use PhpMyAdmin\SqlParser\Utils\Formatter;
|
|
|
|
/**
|
|
* Format SQL for SQL editors.
|
|
*
|
|
* @package PhpMyAdmin\Controllers\Database
|
|
*/
|
|
class SqlFormatController extends AbstractController
|
|
{
|
|
/**
|
|
* @param array $params Request parameters
|
|
*
|
|
* @return array
|
|
*/
|
|
public function index(array $params): array
|
|
{
|
|
$query = strlen((string) $params['sql']) > 0 ? $params['sql'] : '';
|
|
return ['sql' => Formatter::format($query)];
|
|
}
|
|
}
|