27 lines
670 B
PHP
27 lines
670 B
PHP
<?php
|
|
|
|
|
|
namespace Empik\Marketplace\Factory;
|
|
|
|
use Empik\Marketplace\Adapter\ConfigurationAdapter;
|
|
use Empik\Marketplace\API\EmpikClient;
|
|
|
|
class EmpikClientFactory
|
|
{
|
|
/** @var ConfigurationAdapter */
|
|
protected $configurationAdapter;
|
|
|
|
public function __construct(ConfigurationAdapter $configurationAdapter)
|
|
{
|
|
$this->configurationAdapter = $configurationAdapter;
|
|
}
|
|
|
|
public function createClient()
|
|
{
|
|
$apiUrl = $this->configurationAdapter->get(ConfigurationAdapter::CONF_ENVIRONMENT);
|
|
$apiKey = $this->configurationAdapter->get(ConfigurationAdapter::CONF_API_KEY);
|
|
|
|
return new EmpikClient($apiUrl, $apiKey);
|
|
}
|
|
}
|