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

Allow PHP 8.2 and higher #98

Open
wants to merge 7 commits 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
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
39 changes: 39 additions & 0 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Testing

on: [push]

jobs:

phpunit:
strategy:
matrix:
php-versions: [ '8.0', '8.1', '8.2' ]
name: 'PHPUnit [PHP ${{ matrix.php-versions }}]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
extensions: 'json curl xml openssl'
env:
update: true
- name: Get Composer Cache Directory
id: composer-cache
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
- name: Cache Composer Dependencies
uses: actions/cache@v2
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
- name: Installing Composer Packages
run: 'composer install --no-scripts --prefer-dist'
- name: Unit Tests
run: composer test:coverage -- --coverage-clover clover.xml
- name: Upload to codecov
uses: codecov/codecov-action@v2
with:
files: ./clover.xml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ vendor
composer.lock
amazon-pay.phar
build

.idea
23 changes: 3 additions & 20 deletions AmazonPay/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,13 @@
* returns Response Object
*/

require_once 'ResponseParser.php';
require_once 'HttpCurl.php';
require_once 'ClientInterface.php';
require_once 'Regions.php';
if (!interface_exists('\Psr\Log\LoggerAwareInterface')) {
require_once(__DIR__.'/../Psr/Log/LoggerAwareInterface.php');
}

if (!interface_exists('\Psr\Log\LoggerInterface')) {
require_once(__DIR__.'/../Psr/Log/LoggerInterface.php');
}
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerAwareTrait;

class Client implements ClientInterface, LoggerAwareInterface
{
use LoggerAwareTrait;

const SDK_VERSION = '3.7.1';
const MWS_VERSION = '2013-01-01';
const MAX_ERROR_RETRY = 3;
Expand Down Expand Up @@ -62,9 +53,6 @@ class Client implements ClientInterface, LoggerAwareInterface
private $profileEndpointUrls;
private $regionMappings;

// Implement a logging library that utilizes the PSR 3 logger interface
private $logger = null;

// Boolean variable to check if the API call was a success
public $success = false;

Expand Down Expand Up @@ -101,11 +89,6 @@ public function __construct($config = null)
}


public function setLogger(LoggerInterface $logger = null) {
$this->logger = $logger;
}


/* Helper function to log data within the Client */
private function logMessage($message) {
if ($this->logger) {
Expand Down
2 changes: 0 additions & 2 deletions AmazonPay/HttpCurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* Handles Curl POST function for all requests
*/

require_once 'HttpCurlInterface.php';

class HttpCurl implements HttpCurlInterface
{
private $config = array();
Expand Down
18 changes: 2 additions & 16 deletions AmazonPay/IpnHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@
* verifies that the IPN is from the right resource and has the valid data
*/

require_once 'HttpCurl.php';
require_once 'IpnHandlerInterface.php';
if (!interface_exists('\Psr\Log\LoggerAwareInterface')) {
require_once(__DIR__.'/../Psr/Log/LoggerAwareInterface.php');
}
if (!interface_exists('\Psr\Log\LoggerInterface')) {
require_once(__DIR__.'/../Psr/Log/LoggerInterface.php');
}
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerAwareTrait;

class IpnHandler implements IpnHandlerInterface, LoggerAwareInterface
{
use LoggerAwareTrait;

private $headers = null;
private $body = null;
Expand All @@ -29,9 +22,6 @@ class IpnHandler implements IpnHandlerInterface, LoggerAwareInterface
private $expectedCnName = 'sns.amazonaws.com';
private $defaultHostPattern = '/^sns\.[a-zA-Z0-9\-]{3,}\.amazonaws\.com(\.cn)?$/';

// Implement a logging library that utilizes the PSR 3 logger interface
private $logger = null;

private $ipnConfig = array('cabundle_file' => null,
'proxy_host' => null,
'proxy_port' => -1,
Expand Down Expand Up @@ -86,10 +76,6 @@ private function checkConfigKeys($ipnConfig)
}
}

public function setLogger(LoggerInterface $logger = null) {
$this->logger = $logger;
}

/* Helper function to log data within the Client */

private function logMessage($message) {
Expand Down
2 changes: 0 additions & 2 deletions AmazonPay/ResponseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* Methods provided to convert the Response from the POST to XML, Array or JSON
*/

require_once 'ResponseInterface.php';

class ResponseParser implements ResponseInterface
{
public $response = null;
Expand Down
128 changes: 0 additions & 128 deletions Psr/Log/AbstractLogger.php

This file was deleted.

7 changes: 0 additions & 7 deletions Psr/Log/InvalidArgumentException.php

This file was deleted.

18 changes: 0 additions & 18 deletions Psr/Log/LogLevel.php

This file was deleted.

18 changes: 0 additions & 18 deletions Psr/Log/LoggerAwareInterface.php

This file was deleted.

26 changes: 0 additions & 26 deletions Psr/Log/LoggerAwareTrait.php

This file was deleted.

Loading