These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Yansongda\LaravelPay; |
||
4 | |||
5 | use Illuminate\Foundation\Application as LaravelApplication; |
||
6 | use Illuminate\Support\ServiceProvider; |
||
7 | use Laravel\Lumen\Application as LumenApplication; |
||
8 | use Yansongda\Pay\Pay; |
||
9 | |||
10 | class PayServiceProvider extends ServiceProvider |
||
11 | { |
||
12 | /** |
||
13 | * Determin is defer. |
||
14 | * |
||
15 | * @var bool |
||
16 | */ |
||
17 | protected $defer = true; |
||
18 | |||
19 | /** |
||
20 | * Boot the service. |
||
21 | * |
||
22 | * @author yansongda <[email protected]> |
||
23 | */ |
||
24 | public function boot() |
||
25 | { |
||
26 | if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { |
||
0 ignored issues
–
show
|
|||
27 | $this->publishes([ |
||
28 | dirname(__DIR__).'/config/pay.php' => config_path('pay.php'), ], |
||
29 | 'laravel-pay' |
||
30 | ); |
||
31 | } elseif ($this->app instanceof LumenApplication) { |
||
0 ignored issues
–
show
The class
Laravel\Lumen\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed.
Loading history...
|
|||
32 | $this->app->configure('pay'); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Regist the service. |
||
38 | * |
||
39 | * @author yansongda <[email protected]> |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | public function register() |
||
44 | { |
||
45 | $this->mergeConfigFrom(dirname(__DIR__).'/config/pay.php', 'pay'); |
||
46 | |||
47 | $this->app->singleton('pay.alipay', function () { |
||
48 | return Pay::alipay(config('pay.alipay')); |
||
49 | }); |
||
50 | $this->app->singleton('pay.wechat', function () { |
||
51 | return Pay::wechat(config('pay.wechat')); |
||
52 | }); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Get services. |
||
57 | * |
||
58 | * @author yansongda <[email protected]> |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | public function provides() |
||
63 | { |
||
64 | return ['pay.alipay', 'pay.wechat']; |
||
65 | } |
||
66 | } |
||
67 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.