Skip to content

Commit 76dc036

Browse files
authored
Update deps and PHP requirements (#9)
* update deps and fix files * update deps and fix files * update scrutinizer CI step and minor changes * update CI and phpstan stuff * update CI * add coveralls package * bump coveralls
1 parent f433ba5 commit 76dc036

File tree

71 files changed

+432
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+432
-587
lines changed

.github/workflows/php.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,54 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
11+
php-versions: ['8.0', '8.1', '8.2', '8.3']
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
# Fetch 10 commits or Scrutinizer will throw ("Failed to retrieve commit parents.
1717
# If you use a shallow git checkout, please checkout at least a depth of one."),
1818
# see: RepositoryIntrospector at scrutinizer-ci/ocular GitHub repository
1919
fetch-depth: 10
20+
2021
- name: Setup PHP
2122
uses: shivammathur/setup-php@v2
2223
with:
2324
php-version: ${{ matrix.php-versions }}
2425
extensions: curl, mbstring, intl, libxml, simplexml
2526
coverage: xdebug
27+
2628
- name: Get composer cache directory
2729
id: composer-cache-dir
28-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
30+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
31+
2932
- name: Cache Composer packages
3033
id: composer-cache-restore
31-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3235
with:
3336
path: ${{ steps.composer-cache-dir.outputs.dir }}
3437
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3538
restore-keys: ${{ runner.os }}-composer-
39+
3640
- name: Install dependencies
3741
run: (test -d vendor && echo vendor directory exists) || composer install --prefer-dist --no-progress --no-suggest
42+
3843
- name: Run PHPUnit
3944
run: vendor/bin/phpunit --coverage-text --coverage-clover clover.xml
40-
- name: Upload Scrutinizer coverage
41-
if: matrix.php-versions == '8.1'
42-
uses: sudo-bot/action-scrutinizer@latest
43-
with:
44-
cli-args: "--format=php-clover clover.xml"
45+
46+
- name: "[Coveralls] Extract branch name"
47+
if: matrix.php-versions == '8.3'
48+
shell: bash
49+
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
50+
id: extract_branch
51+
52+
- name: "[Coveralls] Checkout branch"
53+
if: matrix.php-versions == '8.3'
54+
shell: bash
55+
run: git fetch && git checkout ${{ steps.extract_branch.outputs.branch }}
56+
57+
- name: "[Coveralls] Send report"
58+
if: matrix.php-versions == '8.3'
59+
run: ./vendor/bin/php-coveralls -v -x clover.xml -o coveralls-upload.json
60+
env:
61+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ clover.xml
99
/tests/demo/paymentID.txt
1010
/tests/demo/shopID.txt
1111
/.php-cs-fixer.cache
12+
/.phpunit.cache/test-results

.php-cs-fixer.dist.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
'protected_to_private' => false,
3838
'strict_param' => true,
3939
'single_quote' => false,
40-
'single_blank_line_before_namespace' => true,
4140
'single_blank_line_at_eof' => true,
4241
'single_trait_insert_per_statement' => false,
4342
'whitespace_after_comma_in_array' => true,

composer.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@
1919
},
2020
"license": "BSD-3-Clause",
2121
"require": {
22-
"php": ">=7.2",
22+
"php": ">=8.0.2",
2323
"ext-curl": "*",
2424
"ext-libxml": "*",
2525
"ext-mbstring": "*",
2626
"ext-simplexml": "*",
27-
"illuminate/support": "^5.8|^6.0|^7.0|^8.0|^9.0",
27+
"illuminate/support": "^9.0|^10.0|^11.0",
2828
"guzzlehttp/guzzle": "~6.0|^7.0"
2929
},
3030
"require-dev": {
31-
"friendsofphp/php-cs-fixer": "^2.16|^3.0",
32-
"phpunit/phpunit": "^7.5|^8.0|^9.0",
33-
"phpstan/phpstan": "^1.4",
34-
"illuminate/config": "^5.8|^6.0|^7.0|^8.0|^9.0",
35-
"orchestra/testbench": "^3.7|^4.0|^5.0|^6.0|^7.0"
31+
"friendsofphp/php-cs-fixer": "^3.0",
32+
"phpunit/phpunit": "^9.0|^10.0|^11.0",
33+
"phpstan/phpstan": "^1.11",
34+
"illuminate/config": "^9.0|^10.0|^11.0",
35+
"orchestra/testbench": "^7.0|^8.0|^9.0",
36+
"php-coveralls/php-coveralls": "^2.7"
3637
},
3738
"autoload": {
3839
"psr-4": {

phpunit.xml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
bootstrap="vendor/autoload.php"
6-
colors="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false"
12-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
13-
<coverage>
14-
<include>
15-
<directory suffix=".php">./src/</directory>
16-
</include>
17-
</coverage>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
backupGlobals="false"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
processIsolation="false"
8+
stopOnFailure="false"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd"
10+
cacheDirectory=".phpunit.cache"
11+
backupStaticProperties="false">
1812
<testsuites>
1913
<testsuite name="Unit">
2014
<directory suffix="Test.php">./tests/Unit</directory>
2115
</testsuite>
2216
</testsuites>
17+
<source>
18+
<include>
19+
<directory suffix=".php">./src/</directory>
20+
</include>
21+
</source>
2322
</phpunit>

src/Actions.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@
22

33
namespace PagOnline;
44

5-
/**
6-
* Class Actions.
7-
*/
85
final class Actions
96
{
107
// Init
11-
const IGFS_CG_INIT = Init\IgfsCgInit::class;
12-
const IGFS_CG_SELECTOR = Init\IgfsCgSelector::class;
13-
const IGFS_CG_VERIFY = Init\IgfsCgVerify::class;
8+
public const IGFS_CG_INIT = Init\IgfsCgInit::class;
9+
public const IGFS_CG_SELECTOR = Init\IgfsCgSelector::class;
10+
public const IGFS_CG_VERIFY = Init\IgfsCgVerify::class;
1411

1512
// Mpi
16-
const IGFS_CG_MPI_AUTH = Mpi\IgfsCgMpiAuth::class;
17-
const IGFS_CG_MPI_ENROLL = Mpi\IgfsCgMpiEnroll::class;
13+
public const IGFS_CG_MPI_AUTH = Mpi\IgfsCgMpiAuth::class;
14+
public const IGFS_CG_MPI_ENROLL = Mpi\IgfsCgMpiEnroll::class;
1815

1916
// PayByMail
20-
const IGFS_CG_PAY_BY_MAIL_INIT = PayByMail\IgfsCgPayByMailInit::class;
21-
const IGFS_CG_PAY_BY_MAIL_VERIFY = PayByMail\IgfsCgPayByMailVerify::class;
17+
public const IGFS_CG_PAY_BY_MAIL_INIT = PayByMail\IgfsCgPayByMailInit::class;
18+
public const IGFS_CG_PAY_BY_MAIL_VERIFY = PayByMail\IgfsCgPayByMailVerify::class;
2219

2320
// Tokenizer
24-
const IGFS_CG_TOKENIZER_CHECK = Tokenizer\IgfsCgTokenizerCheck::class;
25-
const IGFS_CG_TOKENIZER_DELETE = Tokenizer\IgfsCgTokenizerDelete::class;
26-
const IGFS_CG_TOKENIZER_ENROLL = Tokenizer\IgfsCgTokenizerEnroll::class;
21+
public const IGFS_CG_TOKENIZER_CHECK = Tokenizer\IgfsCgTokenizerCheck::class;
22+
public const IGFS_CG_TOKENIZER_DELETE = Tokenizer\IgfsCgTokenizerDelete::class;
23+
public const IGFS_CG_TOKENIZER_ENROLL = Tokenizer\IgfsCgTokenizerEnroll::class;
2724

2825
// Tran
29-
const IGFS_CG_AUTH = Tran\IgfsCgAuth::class;
30-
const IGFS_CG_CONFIRM = Tran\IgfsCgConfirm::class;
31-
const IGFS_CG_CREDIT = Tran\IgfsCgCredit::class;
32-
const IGFS_CG_VOID_AUTH = Tran\IgfsCgVoidAuth::class;
26+
public const IGFS_CG_AUTH = Tran\IgfsCgAuth::class;
27+
public const IGFS_CG_CONFIRM = Tran\IgfsCgConfirm::class;
28+
public const IGFS_CG_CREDIT = Tran\IgfsCgCredit::class;
29+
public const IGFS_CG_VOID_AUTH = Tran\IgfsCgVoidAuth::class;
3330
}

src/BaseIgfsCg.php

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
use PagOnline\Exceptions\IgfsMissingParException;
99
use PagOnline\Exceptions\IOException;
1010
use PagOnline\Traits\HttpClient;
11-
use SimpleXMLElement;
1211

13-
/**
14-
* Class BaseIgfsCg.
15-
*/
1612
abstract class BaseIgfsCg implements IgfsCgInterface
1713
{
1814
use HttpClient;
@@ -22,7 +18,7 @@ abstract class BaseIgfsCg implements IgfsCgInterface
2218
*
2319
* @var string
2420
*/
25-
const VERSION = '2.4.1.5';
21+
public const VERSION = '2.4.1.5';
2622

2723
/**
2824
* Signature Key.
@@ -36,18 +32,18 @@ abstract class BaseIgfsCg implements IgfsCgInterface
3632
*
3733
* @var null|string
3834
*/
39-
public $serverURL = null;
40-
public $serverURLs = null;
35+
public $serverURL;
36+
public $serverURLs;
4137

42-
public $shopID = null;
38+
public $shopID;
4339

44-
public $tid = null;
45-
public $merID = null;
46-
public $payInstr = null;
40+
public $tid;
41+
public $merID;
42+
public $payInstr;
4743

48-
public $rc = null;
49-
public $error = null;
50-
public $errorDesc = null;
44+
public $rc;
45+
public $error;
46+
public $errorDesc;
5147

5248
protected static $soapBodyTag = 'Body';
5349
protected static $soapResponseParentTag = '';
@@ -62,18 +58,12 @@ abstract class BaseIgfsCg implements IgfsCgInterface
6258

6359
protected $fields2Reset = false;
6460

65-
/**
66-
* BaseIgfsCg constructor.
67-
*/
6861
public function __construct()
6962
{
7063
$this->generateHttpClient();
7164
}
7265

73-
/**
74-
* Reset fields.
75-
*/
76-
public function resetFields()
66+
public function resetFields(): void
7767
{
7868
$this->tid = null;
7969
$this->merID = null;
@@ -115,15 +105,15 @@ public function execute(): bool
115105
$mapResponse = $this->executeHttp($this->serverURL);
116106
} else {
117107
$sURLs = $this->serverURLs;
118-
$sURL = \array_shift($sURLs);
108+
$sURL = array_shift($sURLs);
119109
$finished = false;
120110
while (!$finished) {
121111
try {
122112
$mapResponse = $this->executeHttp($sURL);
123113
$finished = true;
124114
} catch (ConnectionException $e) {
125115
if (!empty($sURLs)) {
126-
$sURL = \array_shift($sURLs);
116+
$sURL = array_shift($sURLs);
127117
} else {
128118
throw $e;
129119
}
@@ -206,12 +196,7 @@ abstract protected function getAdditionalRequestSignatureFields(): array;
206196

207197
/***
208198
* Generates a signature
209-
*
210-
* @param $signatureFields
211-
*
212199
* @throws IgfsException
213-
*
214-
* @return string
215200
*/
216201
protected function getSignature(array $signatureFields): string
217202
{
@@ -221,8 +206,8 @@ protected function getSignature(array $signatureFields): string
221206
$data .= (string) $value;
222207
}
223208

224-
return \base64_encode(\hash_hmac('sha256', $data, $this->kSig, true));
225-
} catch (\Exception $e) {
209+
return base64_encode(hash_hmac('sha256', $data, $this->kSig, true));
210+
} catch (\Throwable $e) {
226211
throw new IgfsException($e);
227212
}
228213
}
@@ -238,7 +223,7 @@ protected function getSignature(array $signatureFields): string
238223
*/
239224
protected function setRequestSignature(&$request): void
240225
{
241-
$signatureFields = \array_merge(
226+
$signatureFields = array_merge(
242227
$this->getCommonRequestSignatureFields(),
243228
$this->getAdditionalRequestSignatureFields()
244229
);
@@ -302,7 +287,7 @@ protected function replaceRequestParameter(
302287
$xmlTag .= $wrap_cdata ? "<![CDATA[{$value}]]>" : $value;
303288
$xmlTag .= "</{$parameter}>";
304289
}
305-
$request = \str_replace('{'.$parameter.'}', $xmlTag, $request);
290+
$request = str_replace('{'.$parameter.'}', $xmlTag, $request);
306291
}
307292

308293
/**
@@ -327,12 +312,13 @@ abstract protected function getResponseSignature($response);
327312
/**
328313
* @param string $response
329314
*
330-
* @return null|SimpleXMLElement
315+
* @return null|\SimpleXMLElement
331316
*/
332-
protected function responseXmlToObject(string $response): ?SimpleXMLElement
317+
protected function responseXmlToObject(string $response): ?\SimpleXMLElement
333318
{
334319
try {
335-
$dom = new SimpleXMLElement($response, LIBXML_NOERROR, false);
320+
$dom = new \SimpleXMLElement($response, LIBXML_NOERROR, false);
321+
336322
/*$responseNode = $dom->children('soap', true)->{static::$soapBodyTag}
337323
->children('ns1', true)->{static::$soapResponseParentTag}
338324
->children()
@@ -399,8 +385,8 @@ protected function checkResponseSignature($response)
399385
/**
400386
* @param string $url
401387
*
402-
* @throws \PagOnline\Exceptions\IOException
403-
* @throws \PagOnline\Exceptions\IgfsException
388+
* @throws IOException
389+
* @throws IgfsException
404390
*
405391
* @return array
406392
*/

src/BaseIgfsCgRequest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
namespace PagOnline;
44

5-
/**
6-
* Class BaseIgfsCgRequest.
7-
*/
85
abstract class BaseIgfsCgRequest
96
{
10-
const CONTENT = '';
7+
public const CONTENT = '';
118

129
/**
1310
* @return string

0 commit comments

Comments
 (0)