<commit_before><?php
namespace Apitude\Core\Provider;


use Apitude\Core\Commands\Entities\ListCommand;
use Apitude\Core\Commands\Entities\TypesCommand;
use Knp\Provider\ConsoleServiceProvider;
use Silex\Application;
use Silex\ServiceProviderInterface;

class CommandServiceProvider implements ServiceProviderInterface
{

    /**
     * Registers services on the given app.
     *
     * This method should only be used to configure services and parameters.
     * It should not get services.
     * @param Application $app
     */
    public function register(Application $app)
    {
        if (php_sapi_name() === 'cli') {
            $app['console.setup'] = [];
            $app['console.prerun'] = [];
            $app['console.postrun'] = [];

            $app->register(new ConsoleServiceProvider, [
                'console.name' => 'Apitude',
                'console.version' => '1.0.0',
                'console.project_directory' => APP_PATH,
            ]);
            $app['base_commands'] = $app->share(function() {
                return [
                    TypesCommand::class,
                    ListCommand::class,
                ];
            });
        }
    }

    /**<commit_msg>use share & extend for console workflows<commit_after><?php
namespace Apitude\Core\Provider;


use Apitude\Core\Commands\Entities\ListCommand;
use Apitude\Core\Commands\Entities\TypesCommand;
use Knp\Provider\ConsoleServiceProvider;
use Silex\Application;
use Silex\ServiceProviderInterface;

class CommandServiceProvider implements ServiceProviderInterface
{

    /**
     * Registers services on the given app.
     *
     * This method should only be used to configure services and parameters.
     * It should not get services.
     * @param Application $app
     */
    public function register(Application $app)
    {
        if (php_sapi_name() === 'cli') {
            $app['console.setup'] = $app->share(function () {
                return [];
            });
            $app['console.prerun'] = $app->share(function () {
                return [];
            });
            $app['console.postrun'] = $app->share(function () {
                return [];
            });

            $app->register(new ConsoleServiceProvider, [
                'console.name' => 'Apitude',
                'console.version' => '1.0.0',
                'console.project_directory' => APP_PATH,
            ]);
            $app['base_commands'] = $app->share(function() {
                return [
                    TypesCommand::class,
                    ListCommand::class,
                ];
            });
        }
    }

    /**
{'fraction_non_alphanumeric': 0.12386363636363637, 'fraction_numerical': 0.0022727272727272726, 'mean_word_length': 1.9053905390539054, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '3616535', 'n_tokens_mistral': 704, 'n_tokens_neox': 683, 'n_words': 141}