Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Mar 14, 2024
1 parent 84564a7 commit 8dfa2c0
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/MollieServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,11 @@ class MollieServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->setupConfig();
$this->extendSocialite();
}

/**
* Setup the config.
*
* @return void
*/
protected function setupConfig()
{
$source = realpath(__DIR__.'/../config/mollie.php');

if ($this->app->runningInConsole()) {
$this->publishes([$source => config_path('mollie.php')]);
$this->publishes([__DIR__ . '/../config/mollie.php' => config_path('mollie.php')]);
}

$this->mergeConfigFrom($source, 'mollie');
$this->extendSocialite();
}

/**
Expand Down Expand Up @@ -62,18 +49,22 @@ protected function extendSocialite()
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../config/mollie.php', 'mollie');

$this->app->singleton(
MollieApiClient::class,
function (Container $app) {
$client = (new MollieApiClient(new MollieLaravelHttpClientAdapter))
->addVersionString('MollieLaravel/'.self::PACKAGE_VERSION);
->addVersionString('MollieLaravel/' . self::PACKAGE_VERSION);

if (! empty($apiKey = $app['config']['mollie.key'])) {
if (!empty($apiKey = $app['config']['mollie.key'])) {
$client->setApiKey($apiKey);
}

return $client;
}
);

$this->app->singleton(MollieManager::class);
}
}

0 comments on commit 8dfa2c0

Please sign in to comment.