<commit_before><?php

namespace Mms\Organizations;

use Illuminate\Container\Container;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
use Mms\Laravel\Eloquent\ModelManager;

/**
 * Description of ServiceProvider
 *
 * @author sgueye
 */
class ServiceProvider extends BaseServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__ . '/../config/config.php' => config_path('mms_organizations.php')
        ]);

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/config.php', 'mms_organizations'
        );

        $this->app->bind(OrganizationManager::class, $this->app->share(function (Container $app) {
            return new OrganizationManager(
                $app->make(ModelManager::class),
                $app['config']->get('mms_organizations.model_class'),
                $app['config']->get('mms_organizations.model_type_class'),
                $app['config']->get('mms_organizations.models'),
                $app['config']->get('mms_organizations.relationships')
            );
        }));

        $this->registerCommands();

    }
    protected function registerCommands()
    {
        $this->app->singleton('mms.organizations.init', function(Container $app) {
            return $app->make(Command\BuildOrganizationsCommand::class);
        });
        $this->commands('mms.organizations.init');

        $this->app->singleton('mms.organizations.relationship', function(Container $app) {
            return $app->make(Command\BuildOrganizationsRelationshipCommand::class);
        });
        $this->commands('mms.organizations.relationship');
    }
}
<commit_msg>Create the service for 'OrganizationRelationshipType' and tag it for admin usage<commit_after><?php

namespace Mms\Organizations;

use Illuminate\Container\Container;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
use Mms\Laravel\Eloquent\ModelManager;
use Mms\Organizations\PrezentGrid\Type\OrganizationRelationshipType;
use Mms\Organizations\Tree\ToArrayVisitor;

/**
 * Description of ServiceProvider
 *
 * @author sgueye
 */
class ServiceProvider extends BaseServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__ . '/../config/config.php' => config_path('mms_organizations.php')
        ]);

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/config.php', 'mms_organizations'
        );

        $this->app->bind(OrganizationManager::class, $this->app->share(function (Container $app) {
            return new OrganizationManager(
                $app->make(ModelManager::class),
                $app['config']->get('mms_organizations.model_class'),
                $app['config']->get('mms_organizations.model_type_class'),
                $app['config']->get('mms_organizations.models'),
                $app['config']->get('mms_organizations.relationships')
            );
        }));

        $this->app->bind(OrganizationRelationshipType::class, function(Container $app) {
            return new OrganizationRelationshipType(
                $app->make(OrganizationManager::class),
                $app->make(ToArrayVisitor::class)
            );
        });
        //This seems to be unecessary if the class constructor is type-hintable
        $this->app->tag(OrganizationRelationshipType::class, ['admin.grid_type']);

        $this->registerCommands();

    }
    protected function registerCommands()
    {
        $this->app->singleton('mms.organizations.init', function(Container $app) {
            return $app->make(Command\BuildOrganizationsCommand::class);
        });
        $this->commands('mms.organizations.init');

        $this->app->singleton('mms.organizations.relationship', function(Container $app) {
            return $app->make(Command\BuildOrganizationsRelationshipCommand::class);
        });
        $this->commands('mms.organizations.relationship');
    }
}

{'fraction_non_alphanumeric': 0.1373449701423978, 'fraction_numerical': 0.0, 'mean_word_length': 2.6443514644351462, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '2847987', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1186, 'n_words': 181}