diff --git a/src/OpenPlatform/Application.php b/src/OpenPlatform/Application.php index 386e7a3..0f9c654 100644 --- a/src/OpenPlatform/Application.php +++ b/src/OpenPlatform/Application.php @@ -15,10 +15,10 @@ use EasyWeChat\OpenPlatform\Authorizer\Server\Guard; use function EasyWeChat\Kernel\data_get; /** - * @property \EasyWeChat\OpenPlatform\Server\Guard $server - * @property \EasyWeChat\OpenPlatform\Auth\AccessToken $access_token + * @property \EasyWeChat\OpenPlatform\Server\Guard $server + * @property \EasyWeChat\OpenPlatform\Auth\AccessToken $access_token * @property \EasyWeChat\OpenPlatform\CodeTemplate\Client $code_template - * @property \EasyWeChat\OpenPlatform\Component\Client $component + * @property \EasyWeChat\OpenPlatform\Component\Client $component * * @method mixed handleAuthorize(string $authCode = null) * @method mixed getAuthorizer(string $appId) @@ -55,9 +55,9 @@ class Application extends ServiceContainer /** * Creates the officialAccount application. * - * @param string $appId - * @param string|null $refreshToken - * @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken + * @param string $appId + * @param string|null $refreshToken + * @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken * * @return \EasyWeChat\OpenPlatform\Authorizer\OfficialAccount\Application */ @@ -65,7 +65,8 @@ class Application extends ServiceContainer string $appId, string $refreshToken = null, AccessToken $accessToken = null - ): OfficialAccount { + ): OfficialAccount + { $application = new OfficialAccount( $this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [ @@ -84,7 +85,9 @@ class Application extends ServiceContainer $socialite->withComponent( [ 'id' => $this['config']['app_id'], - 'token' => fn () => $this['access_token']->getToken()['component_access_token'], + 'token' => function () { + return $this['access_token']->getToken()['component_access_token']; + } ] ); @@ -98,9 +101,9 @@ class Application extends ServiceContainer /** * Creates the miniProgram application. * - * @param string $appId - * @param string|null $refreshToken - * @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken + * @param string $appId + * @param string|null $refreshToken + * @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken * * @return \EasyWeChat\OpenPlatform\Authorizer\MiniProgram\Application */ @@ -108,7 +111,8 @@ class Application extends ServiceContainer string $appId, string $refreshToken = null, AccessToken $accessToken = null - ): MiniProgram { + ): MiniProgram + { return new MiniProgram( $this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [ @@ -130,8 +134,8 @@ class Application extends ServiceContainer /** * Return the pre-authorization login page url. * - * @param string $callbackUrl - * @param string|array|null $optional + * @param string $callbackUrl + * @param string|array|null $optional * * @return string * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException @@ -155,14 +159,14 @@ class Application extends ServiceContainer ] ); - return 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?'.http_build_query($queries); + return 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?' . http_build_query($queries); } /** * Return the pre-authorization login page url (mobile). * - * @param string $callbackUrl - * @param string|array|null $optional + * @param string $callbackUrl + * @param string|array|null $optional * * @return string * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException @@ -189,12 +193,12 @@ class Application extends ServiceContainer ] ); - return 'https://mp.weixin.qq.com/safe/bindcomponent?'.http_build_query($queries).'#wechat_redirect'; + return 'https://mp.weixin.qq.com/safe/bindcomponent?' . http_build_query($queries) . '#wechat_redirect'; } /** - * @param string $appId - * @param string|null $refreshToken + * @param string $appId + * @param string|null $refreshToken * * @return array */ @@ -211,7 +215,7 @@ class Application extends ServiceContainer } /** - * @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken + * @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken * * @return array */ @@ -239,8 +243,8 @@ class Application extends ServiceContainer /** * Handle dynamic calls. * - * @param string $method - * @param array $args + * @param string $method + * @param array $args * * @return mixed */