<commit_before><?php

// Our homepage route.
$app->any('/', '\\Lchski\\MainController');

$app->group('/migrations', function() {
	$this->get('/{migrationName}/{migrationDirection}', 'migration_controller');
});

// All our API routes, in one place.
$app->group('/api', function() {

    $this->group('/v1', function() {

        $this->any('/nodes', function( \Slim\Http\Request $request, \Slim\Http\Response $response, array $args) {
            $dbHelper = $this->get('orientdb_helper');

            switch( $request->getMethod() ) {
                case 'GET':
                    $responseContent = $dbHelper->getAllNodes();
                    break;
                case 'POST':
                    $responseContent = $dbHelper->createNode($request->getParsedBody());
                    break;
                default:
                    $responseContent = 'No response defined for that API method.';
                    break;
            }

            return $response
                ->withHeader('Content-Type', 'application/json')
                ->write(
                    json_encode( $responseContent, JSON_PRETTY_PRINT )
                );
        });

        $this->any('/nodes/{node_cluster}/{node_id}', function( \Slim\Http\Request $request, \Slim\Http\Response $response, array $args) {
            $dbHelper = $this->get('orientdb_helper');

            $rid = '#' . $args['node_cluster'] . ':' . $args['node_id'];

            switch( $request->getMethod() ) {
                case 'GET':
                    $responseContent = $dbHelper->getNodes(array("@rid" => $rid));
                    break;
                case 'DELETE':
                    $responseContent = $dbHelper->deleteNodes(array("@rid" => $rid));
                    break;
                default:
                    $responseContent = 'No response defined for that API method.';
                    break;
            }

            return $response
                ->withHeader('Content-Type', 'application/json')
                ->write(
                    json_encode( $responseContent, JSON_PRETTY_PRINT )
                );
        });

        $this->get('/things/connection/{name}', function( \Slim\Http\Request $request, \Slim\Http\Response $response, array $args ) {
            $dbHelper = $this->get('orientdb_helper');

            return $response
                ->withHeader('Content-type', 'application/json')
                ->write(
                    json_encode( $dbHelper->getConnections( ['name' => $args['name']] ), JSON_PRETTY_PRINT )
                );
        });
    });

});<commit_msg>start to /connections routes<commit_after><?php

// Our homepage route.
$app->any('/', '\\Lchski\\MainController');

$app->group('/migrations', function() {
	$this->get('/{migrationName}/{migrationDirection}', 'migration_controller');
});

// All our API routes, in one place.
$app->group('/api', function() {

    $this->group('/v1', function() {

        $this->any('/nodes', function( \Slim\Http\Request $request, \Slim\Http\Response $response, array $args) {
            $dbHelper = $this->get('orientdb_helper');

            switch( $request->getMethod() ) {
                case 'GET':
                    $responseContent = $dbHelper->getAllNodes();
                    break;
                case 'POST':
                    $responseContent = $dbHelper->createNode($request->getParsedBody());
                    break;
                default:
                    $responseContent = 'No response defined for that API method.';
                    break;
            }

            return $response
                ->withHeader('Content-Type', 'application/json')
                ->write(
                    json_encode( $responseContent, JSON_PRETTY_PRINT )
                );
        });

        $this->any('/nodes/{node_cluster}/{node_id}', function( \Slim\Http\Request $request, \Slim\Http\Response $response, array $args) {
            $dbHelper = $this->get('orientdb_helper');

            $rid = '#' . $args['node_cluster'] . ':' . $args['node_id'];

            switch( $request->getMethod() ) {
                case 'GET':
                    $responseContent = $dbHelper->getNodes(array("@rid" => $rid));
                    break;
                case 'DELETE':
                    $responseContent = $dbHelper->deleteNodes(array("@rid" => $rid));
                    break;
                default:
                    $responseContent = 'No response defined for that API method.';
                    break;
            }

            return $response
                ->withHeader('Content-Type', 'application/json')
                ->write(
                    json_encode( $responseContent, JSON_PRETTY_PRINT )
                );
        });

        $this->any('/connections', function( \Slim\Http\Request $request, \Slim\Http\Response $response, array $args) {
            $dbHelper = $this->get('orientdb_helper');

            switch( $request->getMethod() ) {
                case 'GET':
                    $responseContent = $dbHelper->getAllConnections();
                    break;
                case 'POST':
                    $responseContent = $dbHelper->createConnection($request->getParsedBody());
                    break;
                default:
                    $responseContent = 'No response defined for that API method.';
                    break;
            }

            return $response
                ->withHeader('Content-Type', 'application/json')
                ->write(
                    json_encode( $responseContent, JSON_PRETTY_PRINT )
                );
        });
    });

});
{'fraction_non_alphanumeric': 0.14779541446208114, 'fraction_numerical': 0.0003527336860670194, 'mean_word_length': 1.5718820861678005, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '2678829', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1418, 'n_words': 275}