1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Freyo\Flysystem\QcloudCOSv4; |
4
|
|
|
|
5
|
|
|
use Freyo\Flysystem\QcloudCOSv4\Plugins\GetUrl; |
6
|
|
|
use Freyo\Flysystem\QcloudCOSv4\Plugins\PutRemoteFile; |
7
|
|
|
use Freyo\Flysystem\QcloudCOSv4\Plugins\PutRemoteFileAs; |
8
|
|
|
use Illuminate\Foundation\Application as LaravelApplication; |
9
|
|
|
use Illuminate\Support\Facades\Storage; |
10
|
|
|
use Illuminate\Support\ServiceProvider as LaravelServiceProvider; |
11
|
|
|
use Laravel\Lumen\Application as LumenApplication; |
12
|
|
|
use League\Flysystem\Filesystem; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class ServiceProvider. |
16
|
|
|
*/ |
17
|
|
|
class ServiceProvider extends LaravelServiceProvider |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Bootstrap any application services. |
21
|
|
|
* |
22
|
|
|
* @return void |
23
|
|
|
*/ |
24
|
|
|
public function boot() |
25
|
|
|
{ |
26
|
|
|
$source = realpath(__DIR__ . '/filesystems.php'); |
27
|
|
|
|
28
|
|
|
if ($this->app instanceof LaravelApplication) { |
|
|
|
|
29
|
|
|
if ($this->app->runningInConsole()) { |
30
|
|
|
$this->publishes([ |
31
|
|
|
$source => config_path('filesystems.php'), |
32
|
|
|
]); |
33
|
|
|
} |
34
|
|
|
} elseif ($this->app instanceof LumenApplication) { |
|
|
|
|
35
|
|
|
$this->app->configure('filesystems'); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
$this->app->make('filesystem') |
39
|
|
|
->extend('cosv4', function ($app, $config) { |
40
|
|
|
return new Filesystem(new Adapter($config)); |
41
|
|
|
}) |
42
|
|
|
->disk('cosv4') |
43
|
|
|
->addPlugin(new PutRemoteFile()) |
44
|
|
|
->addPlugin(new PutRemoteFileAs()) |
45
|
|
|
->addPlugin(new GetUrl()); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Register any application services. |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
public function register() |
54
|
|
|
{ |
55
|
|
|
$this->mergeConfigFrom( |
56
|
|
|
__DIR__.'/filesystems.php', 'filesystems' |
57
|
|
|
); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
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.