Skip to content

Commit 3ff44d4

Browse files
committed
Remove some old Guzzle references.
Omnipay 3.x is now PSR-7 for responses and Symfony for server requests.
1 parent 99cbaae commit 3ff44d4

File tree

3 files changed

+14
-25
lines changed

3 files changed

+14
-25
lines changed

src/Helper.php

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
use Symfony\Component\HttpFoundation\Request;
10-
use Guzzle\Http\Message\Response;
1110
use Psr\Http\Message\ResponseInterface;
1211
use Psr\Http\Message\ServerRequestInterface;
1312
use SimpleXMLElement;
@@ -20,30 +19,25 @@ class Helper
2019
* as XML in a header line or XML in the request body.
2120
* All of these methods are used in various places.
2221
* XML data is parsed into a flat array.
23-
* Supports Guzzle sewrver request/response, but be
24-
* switched to PSR-7 messages in Omnipay 3.x versions.
2522
*
26-
* @param Request|Response|TBC $httpMessage a Guzzle HTTP server request or HTTP response, or a PSR-7 message (TODO)
23+
* @param Request|ResponseInterface $httpMessage a HTTP server request or a PSR-7 message
2724
* @return array the data as a flat array
2825
*/
2926
public static function extractMessageData($httpMessage)
3027
{
31-
// Guzzle 3 Response or PSR-7 response.
32-
// The assumption for now is that it will always be XML.
28+
// The assumption for now is that a syncronous response will always be XML.
3329

34-
if ($httpMessage instanceof Response || $httpMessage instanceof ResponseInterface) {
30+
if ($httpMessage instanceof ResponseInterface) {
3531
$xmlString = (string)$httpMessage->getBody();
3632

3733
$xmlString = simplexml_load_string($xmlString);
3834
return static::parseXmlElement($xmlString);
3935
}
4036

41-
// Guzzle 3 ServerRequest.
42-
// CHECKME: when coult this also be a ServerRequestInterface?
43-
37+
// Incoming server request.
4438
// The results could be sent by GET or POST. It's an account
4539
// option, or an overriding request option.
46-
// Could also be XML in a header or the body.
40+
// Could also be XML in a header field or the body.
4741

4842
if ($httpMessage instanceof Request) {
4943
if (static::getMethod($httpMessage) === 'POST') {
@@ -70,21 +64,16 @@ public static function extractMessageData($httpMessage)
7064

7165
// Fall back to standard GET query or POST form parameters.
7266

73-
return static::getFormData($httpMessage);
67+
if (static::getMethod($httpMessage) === 'POST') {
68+
return $httpMessage->request->all();
69+
} else {
70+
return $httpMessage->query->all();
71+
}
7472
}
7573

7674
return [];
7775
}
7876

79-
public static function getFormData($httpMessage)
80-
{
81-
if (static::getMethod($httpMessage) === 'POST') {
82-
return $httpMessage->request->all();
83-
} else {
84-
return $httpMessage->query->all();
85-
}
86-
}
87-
8877
public static function getMethod($httpMessage)
8978
{
9079
return strtoupper($httpMessage->getMethod());

src/Message/AbstractNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use Omnipay\Common\Helper;
1818
use Symfony\Component\HttpFoundation\ParameterBag;
19-
use Guzzle\Http\ClientInterface;
19+
use Omnipay\Common\Http\ClientInterface;
2020
use Symfony\Component\HttpFoundation\Request as HttpRequest;
2121

2222
abstract class AbstractNotification implements NotificationInterface
@@ -31,7 +31,7 @@ abstract class AbstractNotification implements NotificationInterface
3131
/**
3232
* The request client.
3333
*
34-
* @var \Guzzle\Http\ClientInterface
34+
* @var \Omnipay\Common\Http\ClientInterface
3535
*/
3636
protected $httpClient;
3737

@@ -45,7 +45,7 @@ abstract class AbstractNotification implements NotificationInterface
4545
/**
4646
* Create a new Request
4747
*
48-
* @param ClientInterface $httpClient A Guzzle client to make API calls with
48+
* @param ClientInterface $httpClient A client to make API calls with
4949
* @param HttpRequest $httpRequest A Symfony HTTP request object
5050
*/
5151
public function __construct(ClientInterface $httpClient, HttpRequest $httpRequest)

src/Traits/HasCompleteResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function getCardReference()
130130
/**
131131
* Virtual card number for MFGroup Checkout
132132
*/
133-
public function getVirtualCardno()
133+
public function getVirtualCardno2()
134134
{
135135
return $this->getDataItem('virtualCardno');
136136
}

0 commit comments

Comments
 (0)