server/src/app/Providers/RepositoryServiceProvider.php
author nowmad@nowmads-macbook-pro.local
Mon, 30 Nov 2015 17:50:25 +0100
changeset 37 343750d4d38e
parent 4 f55970e41793
child 126 e87a340711a4
permissions -rw-r--r--
small improvment of style and add forgotten tabs "thematiques"

<?php
namespace CorpusParole\Providers;

use Illuminate\Support\ServiceProvider;

/**
 * Service provider charged to bind repository interfaces to implementations
 */
class RepositoryServiceProvider extends ServiceProvider {

    public function register() {
        $this->app->bind(
            'CorpusParole\Repositories\DocumentRepository',
            function($app) {

                $httpClient = $app->make('GuzzleHttp\Client', [[ 'base_uri' => config('corpusparole.sesame_query_url'), 'http_errors' => false]]);
                $sparqlClient = $app->make('EasyRdf\Sparql\Client', [config('corpusparole.sesame_query_url'), config('corpusparole.sesame_update_url')]);
                $cpSparqlClient = $app->make('CorpusParole\Libraries\Sparql\SparqlClient', [$httpClient, $sparqlClient]);
                return $app->make('CorpusParole\Repositories\RdfDocumentRepository', [$cpSparqlClient,]);
            }
        );
    }
}