Skip to content

Commit

Permalink
兼容php8
Browse files Browse the repository at this point in the history
  • Loading branch information
justmd5 committed Dec 7, 2021
1 parent bdac285 commit 981a19a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
}
},
"require": {
"php": "^7.0",
"hanson/foundation-sdk": "4.0.2",
"php": "^7.0||^8.0",
"hanson/foundation-sdk": "^5.0",
"ext-json": "*"
}
}
9 changes: 6 additions & 3 deletions src/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Justmd5\PinDuoDuo;

use Hanson\Foundation\AbstractAccessToken;
use Hanson\Foundation\Foundation;

class AccessToken extends AbstractAccessToken
{
Expand All @@ -30,11 +31,13 @@ class AccessToken extends AbstractAccessToken
protected $expiresJsonKey = 'expires_in';

/**
* @param string $clientId
* @param string $secret
* @param string $clientId
* @param string $secret
* @param Foundation $app
*/
public function __construct(string $clientId, string $secret)
public function __construct(string $clientId, string $secret, Foundation $app)
{
parent::__construct($app);
$this->appId = $clientId;
$this->secret = $secret;
}
Expand Down
1 change: 0 additions & 1 deletion src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Api extends AbstractAPI

public function __construct(PinDuoDuo $pinduoduo, $needToken = false)
{
parent::__construct($pinduoduo);
$this->pinduoduo = $pinduoduo;
$this->needToken = $needToken;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Oauth/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function register(Container $pimple)
$pimple['oauth.access_token'] = function (Foundation $pimple) {
$accessToken = new AccessToken(
$pimple->getConfig('client_id'),
$pimple->getConfig('client_secret')
$pimple->getConfig('client_secret'),
$pimple
);
$accessToken->setHttp($pimple->http);
$accessToken->setRequest($pimple['request']);
Expand Down
3 changes: 2 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function register(Container $pimple)
$pimple['access_token'] = function (Foundation $pimple) {
return new AccessToken(
$pimple->getConfig('client_id'),
$pimple->getConfig('client_secret')
$pimple->getConfig('client_secret'),
$pimple
);
};

Expand Down

0 comments on commit 981a19a

Please sign in to comment.