Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit f6ef939

Browse files
committed
Improved namespace structure.
1 parent aff849d commit f6ef939

10 files changed

Lines changed: 28 additions & 31 deletions

File tree

AmazonPay/Client.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
* returns Response Object
88
*/
99

10-
require_once 'ResponseParser.php';
11-
require_once 'HttpCurl.php';
12-
require_once 'ClientInterface.php';
13-
require_once 'Regions.php';
14-
if (!interface_exists('\Psr\Log\LoggerAwareInterface')) {
15-
require_once(__DIR__.'/../Psr/Log/LoggerAwareInterface.php');
16-
}
17-
18-
if (!interface_exists('\Psr\Log\LoggerInterface')) {
19-
require_once(__DIR__.'/../Psr/Log/LoggerInterface.php');
20-
}
2110
use Psr\Log\LoggerAwareInterface;
2211
use Psr\Log\LoggerInterface;
2312

AmazonPay/HttpCurl.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* Handles Curl POST function for all requests
66
*/
77

8-
require_once 'HttpCurlInterface.php';
9-
108
class HttpCurl implements HttpCurlInterface
119
{
1210
private $config = array();

AmazonPay/IpnHandler.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
<?php
2+
23
namespace AmazonPay;
34

45
/* Class IPN_Handler
56
* Takes headers and body of the IPN message as input in the constructor
67
* verifies that the IPN is from the right resource and has the valid data
78
*/
89

9-
require_once 'HttpCurl.php';
10-
require_once 'IpnHandlerInterface.php';
11-
if (!interface_exists('\Psr\Log\LoggerAwareInterface')) {
12-
require_once(__DIR__.'/../Psr/Log/LoggerAwareInterface.php');
13-
}
14-
if (!interface_exists('\Psr\Log\LoggerInterface')) {
15-
require_once(__DIR__.'/../Psr/Log/LoggerInterface.php');
16-
}
1710
use Psr\Log\LoggerAwareInterface;
1811
use Psr\Log\LoggerInterface;
1912

AmazonPay/Regions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace AmazonPay;
34

45
/* Class Regions

AmazonPay/ResponseParser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?php
2+
23
namespace AmazonPay;
34

45
/* ResponseParser
56
* Methods provided to convert the Response from the POST to XML, Array or JSON
67
*/
78

8-
require_once 'ResponseInterface.php';
9-
109
class ResponseParser implements ResponseInterface
1110
{
1211
public $response = null;

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
],
2323
"autoload": {
2424
"psr-4": {
25-
"AmazonPay\\": "AmazonPay/"
25+
"AmazonPay\\": "AmazonPay/",
26+
"Psr\\": "Psr/"
27+
}
28+
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"AmazonPayTst\\":"tst/unit"
2632
}
2733
},
2834
"require": {

phpunit.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<phpunit
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd"
4+
verbose="true"
5+
checkForUnintentionallyCoveredCode="true">
6+
<testsuites>
7+
<testsuite name="Test Amazon Pay Sdk PHP">
8+
<directory>tst/unit</directory>
9+
</testsuite>
10+
</testsuites>
11+
</phpunit>

tst/unit/ClientTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
2-
namespace AmazonPay;
2+
namespace AmazonPayTst;
33

4-
require_once 'AmazonPay/Client.php';
5-
require_once 'AmazonPay/ResponseParser.php';
6-
require_once 'Signature.php';
4+
use AmazonPay\Client;
5+
use AmazonPay\ResponseParser;
76

87
class ClientTest extends \PHPUnit_Framework_TestCase
98
{

tst/unit/IpnHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
2-
namespace AmazonPay;
2+
namespace AmazonPayTst;
33

4-
require_once 'AmazonPay/IpnHandler.php';
4+
use AmazonPay\IpnHandler;
55

66
class IpnHandlertest extends \PHPUnit_Framework_TestCase
77
{

tst/unit/Signature.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
2-
namespace AmazonPay;
2+
3+
namespace AmazonPayTst;
34

45
class Signature
56
{

0 commit comments

Comments
 (0)