Refactor, add traits

This commit is contained in:
Oliver Davies 2020-05-31 00:39:48 +01:00
parent 506b5689fe
commit 0426632a08
4 changed files with 41 additions and 17 deletions

View file

@ -5,28 +5,21 @@ declare(strict_types=1);
namespace Opdavies\Glassboxx\Request;
use Opdavies\Glassboxx\Config;
use Opdavies\Glassboxx\Traits\UsesConfigTrait;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
abstract class AbstractRequest
{
use UsesConfigTrait;
public const BASE_URL = 'https://server.glassboxx.co.uk/rest/V1';
/** @var HttpClient */
protected $client;
/** @var Config */
protected $config;
public function __construct(HttpClientInterface $client)
{
$this->client = $client;
}
public function withConfig(Config $config): AbstractRequest
{
$this->config = $config;
return $this;
}
}