Skip to content

Commit e1c7807

Browse files
authored
Master -> Development (#308)
* Release 4.1.0 * Add helper method to GetSessionResult getFaceComparisonChecks * Add several fixes, update php8.0 -> 8.1, guzzlehttp/guzzle -> 7.0, guzzlehttp/psr7 -> 2.4 * Update github actions php8.0 -> 8.1 * Update github actions for sonar check php8.0 -> 8.1 * Remove support of php7.1 * Modify sonar config for php8.1 * Add php7.4, php8.0 support * Add php7.4, php8.0 support * Update README.md (#306)
1 parent 17b6021 commit e1c7807

16 files changed

+213
-26
lines changed

.github/workflows/sonar.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020
- uses: shivammathur/[email protected]
2121
with:
22-
php-version: 8.0
22+
php-version: 8.1
2323

2424
- run: composer install
2525
- run: composer coverage-clover

.github/workflows/tests.yaml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Unit Tests
22
on: [ push, pull_request_target ]
33

44
jobs:
5-
php8compat:
6-
name: Unit Tests PHP8 Compatibility (php ${{ matrix.php-version }})
5+
php8-1:
6+
name: Unit Tests php8.1 (php ${{ matrix.php-version }})
77
runs-on: ubuntu-latest
88
# always run on push events
99
# only run on pull_request_target event when pull request pulls from fork repository
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-version: [ 8.0 ]
16+
php-version: [ 8.1 ]
1717

1818
steps:
1919
- uses: actions/checkout@v2
@@ -31,14 +31,14 @@ jobs:
3131

3232
- run: composer test
3333

34-
php7:
35-
name: Unit Tests (php ${{ matrix.php-version }})
34+
php7-4:
35+
name: Unit Tests php7.4 (php ${{ matrix.php-version }})
3636
runs-on: ubuntu-latest
3737
# always run on push events
3838
# only run on pull_request_target event when pull request pulls from fork repository
3939
if: >
4040
github.event_name == 'push' ||
41-
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
41+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
4242
strategy:
4343
fail-fast: false
4444
matrix:
@@ -57,6 +57,32 @@ jobs:
5757

5858
- run: composer test
5959

60+
php8-0:
61+
name: Unit Tests php8.0 (php ${{ matrix.php-version }})
62+
runs-on: ubuntu-latest
63+
# always run on push events
64+
# only run on pull_request_target event when pull request pulls from fork repository
65+
if: >
66+
github.event_name == 'push' ||
67+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
php-version: [ 8.0 ]
72+
73+
steps:
74+
- uses: actions/checkout@v2
75+
76+
- uses: shivammathur/[email protected]
77+
with:
78+
php-version: ${{ matrix.php-version }}
79+
80+
- run: composer self-update
81+
82+
- run: composer install --no-interaction --prefer-source --dev
83+
84+
- run: composer test
85+
6086
protobuf:
6187
name: Unit Tests With Protobuf C Extension 3.13 (php ${{ matrix.php-version }})
6288
runs-on: ubuntu-latest
@@ -68,7 +94,7 @@ jobs:
6894
strategy:
6995
fail-fast: false
7096
matrix:
71-
php-version: [ 7.4 ]
97+
php-version: [ 8.1 ]
7298

7399
steps:
74100
- uses: actions/checkout@v2

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
->in(__DIR__ . '/tests')
66
;
77

8-
return PhpCsFixer\Config::create()
8+
$config = new PhpCsFixer\Config();
9+
$config
10+
->setRiskyAllowed(true)
911
->setRules([
1012
'array_syntax' => ['syntax' => 'short'],
1113
'no_unused_imports' => true,
@@ -22,3 +24,5 @@
2224
])
2325
->setFinder($finder)
2426
;
27+
28+
return $config;

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ composer coverage-clover
3232
We follow the [PSR-12 Style Guide](https://www.php-fig.org/psr/psr-12/), which
3333
is configured in [.phpcs.xml.dist](.phpcs.xml.dist).
3434

35-
Additional checks are configured in [.php_cs.dist](.php_cs.dist) - See
35+
Additional checks are configured in [.php-cs-fixer.dist.php](.php-cs-fixer.dist.php) - See
3636
<https://cs.symfony.com/> for further information.
3737

3838
Coding style can be verified by running:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Please feel free to reach out
2727

2828
## Requirements
2929

30-
* PHP ^7.1
30+
* PHP ^7.4 || ^8.0 || ^8.1
3131
* CURL PHP extension (must support TLSv1.2)
3232

3333
### Recommended (optional)
@@ -42,13 +42,13 @@ Add the Yoti SDK dependency:
4242

4343
```json
4444
"require": {
45-
"yoti/yoti-php-sdk" : "^3.0"
45+
"yoti/yoti-php-sdk" : "^4.1"
4646
}
4747
```
4848

4949
Or run this Composer command
5050
```console
51-
$ composer require yoti/yoti-php-sdk "^3.0"
51+
$ composer require yoti/yoti-php-sdk "^4.1"
5252
```
5353

5454
## Setup

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
22
"name": "yoti/yoti-php-sdk",
33
"description": "Yoti SDK for quickly integrating your PHP backend with Yoti",
4-
"version": "4.0.0",
4+
"version": "4.1.0",
55
"keywords": [
66
"yoti",
77
"sdk"
88
],
99
"homepage": "https://yoti.com",
1010
"license": "MIT",
1111
"require": {
12-
"php": "^7.1 || ^8.0",
12+
"php": "^7.4 || ^8.0 || ^8.1",
1313
"ext-json": "*",
1414
"google/protobuf": "^3.10",
1515
"phpseclib/phpseclib": "^3.0",
16-
"guzzlehttp/guzzle": "^6.4 || ^7.0",
16+
"guzzlehttp/guzzle": "^7.0",
1717
"psr/http-client": "^1.0",
1818
"psr/http-message": "^1.0",
19-
"guzzlehttp/psr7": "^2.0",
19+
"guzzlehttp/psr7": "^2.4",
2020
"ext-openssl": "*"
2121
},
2222
"autoload": {
@@ -27,7 +27,7 @@
2727
"require-dev": {
2828
"phpunit/phpunit": "^9.5.13",
2929
"squizlabs/php_codesniffer": "^3.4",
30-
"friendsofphp/php-cs-fixer": "^2.15",
30+
"friendsofphp/php-cs-fixer": "^3.4",
3131
"brainmaestro/composer-git-hooks": "^2.8",
3232
"phpstan/phpstan-strict-rules": "^0.12.1",
3333
"phpstan/extension-installer": "^1.0",
@@ -45,12 +45,12 @@
4545
"coverage-clover": "phpunit --coverage-clover ./coverage/coverage.xml",
4646
"coverage-html": "phpunit --coverage-html ./coverage/report",
4747
"fix": [
48-
"php-cs-fixer fix --config=.php_cs.dist -v --using-cache=no --diff-format=udiff --ansi",
48+
"php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no",
4949
"phpcbf"
5050
],
5151
"lint": [
5252
"phpcs",
53-
"php-cs-fixer fix --config=.php_cs.dist -v --dry-run --using-cache=no --diff-format=udiff --ansi",
53+
"php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --using-cache=no",
5454
"phpstan analyse"
5555
],
5656
"post-install-cmd": "cghooks add --ignore-lock",

src/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Constants
2525
public const SDK_IDENTIFIER = 'PHP';
2626

2727
/** Default SDK version */
28-
public const SDK_VERSION = '4.0.0';
28+
public const SDK_VERSION = '4.1.0';
2929

3030
/** Base url for connect page (user will be redirected to this page eg. baseurl/app-id) */
3131
public const CONNECT_BASE_URL = 'https://www.yoti.com/connect';

src/DocScan/Session/Create/Filters/Document/DocumentRestrictionsFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DocumentRestrictionsFilter extends DocumentFilter implements \JsonSerializ
3232

3333
/**
3434
* @param string $inclusion
35-
* @param array $documents
35+
* @param DocumentRestriction[] $documents
3636
* @param bool|null $allowNonLatinDocuments
3737
* @param bool|null $allowExpiredDocuments
3838
*/

src/DocScan/Session/Retrieve/FaceCaptureImageResponse.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,30 @@
22

33
namespace Yoti\DocScan\Session\Retrieve;
44

5+
use Yoti\Exception\DateTimeException;
6+
57
class FaceCaptureImageResponse
68
{
79
/**
8-
* @var MediaResponse $media
10+
* @var null|MediaResponse $media
911
*/
1012
private $media;
1113

1214
/**
13-
* @return MediaResponse
15+
* @param array<string,mixed> $image
16+
* @throws DateTimeException
17+
*/
18+
public function __construct(array $image)
19+
{
20+
if (isset($image['media'])) {
21+
$this->media = new MediaResponse($image['media']);
22+
}
23+
}
24+
25+
/**
26+
* @return null|MediaResponse
1427
*/
15-
public function getMedia(): MediaResponse
28+
public function getMedia(): ?MediaResponse
1629
{
1730
return $this->media;
1831
}

src/DocScan/Session/Retrieve/FaceCaptureResourceResponse.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@
22

33
namespace Yoti\DocScan\Session\Retrieve;
44

5+
use Yoti\Exception\DateTimeException;
6+
57
class FaceCaptureResourceResponse extends ResourceResponse
68
{
79
/**
810
* @var FaceCaptureImageResponse $image
911
*/
1012
private $image;
1113

14+
/**
15+
* FaceCaptureResourceResponse constructor.
16+
* @param array<string, mixed> $faceCaptures
17+
* @throws DateTimeException
18+
*/
19+
public function __construct(array $faceCaptures)
20+
{
21+
parent::__construct($faceCaptures);
22+
23+
if (isset($faceCaptures['image'])) {
24+
$this->image = new FaceCaptureImageResponse($faceCaptures['image']);
25+
}
26+
}
27+
1228
/**
1329
* @return FaceCaptureImageResponse
1430
*/

0 commit comments

Comments
 (0)