mingyoung /
easywechat-composer
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | * This file is part of the EasyWeChatComposer. |
||
| 7 | * |
||
| 8 | * (c) 张铭阳 <[email protected]> |
||
| 9 | * |
||
| 10 | * This source file is subject to the MIT license that is bundled |
||
| 11 | * with this source code in the file LICENSE. |
||
| 12 | */ |
||
| 13 | |||
| 14 | namespace EasyWeChatComposer\Delegation; |
||
| 15 | |||
| 16 | use EasyWeChat; |
||
| 17 | use EasyWeChatComposer\Http\DelegationResponse; |
||
| 18 | |||
| 19 | class Hydrate |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | protected $attributes; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param array $attributes |
||
| 28 | */ |
||
| 29 | public function __construct(array $attributes) |
||
| 30 | { |
||
| 31 | $this->attributes = $attributes; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return array |
||
| 36 | */ |
||
| 37 | public function handle() |
||
| 38 | { |
||
| 39 | $app = $this->createsApplication()->shouldntDelegate(); |
||
| 40 | |||
| 41 | foreach ($this->attributes['identifiers'] as $identifier) { |
||
| 42 | $app = $app->$identifier; |
||
| 43 | } |
||
| 44 | |||
| 45 | return call_user_func_array([$app, $this->attributes['method']], $this->attributes['arguments']); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return \EasyWeChat\Kernel\ServiceContainer |
||
|
0 ignored issues
–
show
|
|||
| 50 | */ |
||
| 51 | protected function createsApplication() |
||
| 52 | { |
||
| 53 | $application = $this->attributes['application']; |
||
| 54 | |||
| 55 | if ($application === EasyWeChat\OpenPlatform\Authorizer\OfficialAccount\Application::class) { |
||
|
0 ignored issues
–
show
The type
EasyWeChat\OpenPlatform\...cialAccount\Application was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 56 | return $this->createsOpenPlatformApplication('officialAccount'); |
||
| 57 | } |
||
| 58 | |||
| 59 | if ($application === EasyWeChat\OpenPlatform\Authorizer\MiniProgram\Application::class) { |
||
|
0 ignored issues
–
show
The type
EasyWeChat\OpenPlatform\...MiniProgram\Application was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 60 | return $this->createsOpenPlatformApplication('miniProgram'); |
||
| 61 | } |
||
| 62 | |||
| 63 | return new $application($this->buildConfig($this->attributes['config'])); |
||
| 64 | } |
||
| 65 | |||
| 66 | protected function createsOpenPlatformApplication($type) |
||
| 67 | { |
||
| 68 | $config = $this->attributes['config']; |
||
| 69 | |||
| 70 | $authorizerAppId = $config['app_id']; |
||
| 71 | |||
| 72 | $config['app_id'] = $config['component_app_id']; |
||
| 73 | |||
| 74 | return EasyWeChat\Factory::openPlatform($this->buildConfig($config))->$type($authorizerAppId, $config['refresh_token']); |
||
|
0 ignored issues
–
show
The type
EasyWeChat\Factory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 75 | } |
||
| 76 | |||
| 77 | protected function buildConfig(array $config) |
||
| 78 | { |
||
| 79 | $config['response_type'] = DelegationResponse::class; |
||
| 80 | |||
| 81 | return $config; |
||
| 82 | } |
||
| 83 | } |
||
| 84 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths