<commit_before><?php

namespace Lstr\Postgres\DbMgmt\Controller;

use Exception;

use Lstr\Silex\Controller\JsonRequestMiddlewareService;

use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class DbMgmtControllerProvider implements ControllerProviderInterface
{
    public function connect(Application $app)
    {
        $controllers = $app['controllers_factory'];

        $controllers->get(
            '/dump/{id}',
            function (Application $app, Request $request) {
                return $app->json([]);
            }
        );

        $controllers->post(
            '/dump',
            function (Application $app, Request $request) {
                try {
                    //TODO: validate params
                    $job = $app['postgres.db-mgmt-job']->dump(
                        $request->get('host'),
                        $request->get('database'),
                        $request->get('destinationPath'),
                        $request->get('callbackUrl')
                    );

                    return $app->json($job);
                } catch (Exception $exception) {
                    return $app->json($exception->getMessage());<commit_msg>Fix queueDump() method call<commit_after><?php

namespace Lstr\Postgres\DbMgmt\Controller;

use Exception;

use Lstr\Silex\Controller\JsonRequestMiddlewareService;

use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class DbMgmtControllerProvider implements ControllerProviderInterface
{
    public function connect(Application $app)
    {
        $controllers = $app['controllers_factory'];

        $controllers->get(
            '/dump/{id}',
            function (Application $app, Request $request) {
                return $app->json([]);
            }
        );

        $controllers->post(
            '/dump',
            function (Application $app, Request $request) {
                try {
                    //TODO: validate params
                    $job = $app['postgres.db-mgmt-job']->queueDump(
                        $request->get('host'),
                        $request->get('database'),
                        $request->get('destinationPath'),
                        $request->get('callbackUrl')
                    );

                    return $app->json($job);
                } catch (Exception $exception) {
                    return $app->json($exception->getMessage());
{'fraction_non_alphanumeric': 0.11918492887351019, 'fraction_numerical': 0.0, 'mean_word_length': 1.8530701754385965, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '374398', 'n_tokens_mistral': 655, 'n_tokens_neox': 626, 'n_words': 118}