Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set the GuzzleHttp\Client instance on the PHRETS\Session #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "troydavisson/phrets",
"type": "library",
"license": "MIT",
"version": "2.5.1",
"description": "RETS library in PHP",
"keywords": [
"rets",
Expand Down
14 changes: 11 additions & 3 deletions src/Session.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php namespace PHRETS;

use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Cookie\CookieJarInterface;
use GuzzleHttp\Exception\ClientException;
Expand All @@ -16,6 +15,7 @@
use PHRETS\Models\Bulletin;
use PHRETS\Strategies\Strategy;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\ClientInterface as GuzzleClientInterface;

class Session
{
Expand All @@ -41,7 +41,7 @@ public function __construct(Configuration $configuration)
$defaults = [];

// start up our Guzzle HTTP client
$this->client = PHRETSClient::make($defaults);
$this->setClient(PHRETSClient::make($defaults));

$this->cookie_jar = new CookieJar;

Expand Down Expand Up @@ -501,13 +501,21 @@ public function getLastResponse()
}

/**
* @return Client
* @return GuzzleClientInterface
*/
public function getClient()
{
return $this->client;
}

/**
* @param GuzzleClientInterface $client [description]
*/
public function setClient(GuzzleClientInterface $client)
{
$this->client = $client;
}

/**
* @return mixed
*/
Expand Down