server/src/app/Providers/SparqlClientServiceProvider.php
author ymh <ymh.work@gmail.com>
Thu, 10 Nov 2016 01:45:47 +0100
changeset 408 c89c11c2def7
parent 405 f239c8c5bb94
child 531 48f5380c26d0
permissions -rw-r--r--
temporarely hide the share button

<?php
namespace CorpusParole\Providers;

use Illuminate\Support\ServiceProvider;
use CorpusParole\Libraries\Sparql\SparqlClient;

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

    public function register() {
        $this->app->bind(
            'CorpusParole\Libraries\Sparql\SparqlClient',
            function($app) {
                $httpClient = $app->make('GuzzleHttp\Client', [[ 'base_uri' => config('corpusparole.rdf4j_query_url'), 'http_errors' => false]]);
                $sparqlClient = $app->make('EasyRdf\Sparql\Client', [config('corpusparole.rdf4j_query_url'), config('corpusparole.rdf4j_update_url')]);
                return new SparqlClient($httpClient, $sparqlClient);
            }
        );
    }
}