|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace LaravelSwivel; |
|
6
|
|
|
|
|
7
|
|
|
use Illuminate\Contracts\Container\Container; |
|
8
|
|
|
use Illuminate\Support\ServiceProvider; |
|
9
|
|
|
use Illuminate\Foundation\Application as LaravelApplication; |
|
10
|
|
|
use Laravel\Lumen\Application as LumenApplication; |
|
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
class SwivelServiceProvider extends ServiceProvider |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* The package version. |
|
16
|
|
|
* |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
const VERSION = '2.0.0'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Indicates if loading of the provider is deferred. |
|
23
|
|
|
* |
|
24
|
|
|
* @var bool |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $defer = true; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Bootstrap any application services. |
|
30
|
|
|
* |
|
31
|
|
|
* @return void |
|
32
|
|
|
*/ |
|
33
|
2 |
|
public function boot() |
|
34
|
|
|
{ |
|
35
|
2 |
|
$this->setupConfig($this->app); |
|
36
|
|
|
|
|
37
|
2 |
|
$this->loadMigrationsFrom(__DIR__ . '/database/migrations'); |
|
38
|
2 |
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Register the application services. |
|
42
|
|
|
* |
|
43
|
|
|
* @return void |
|
44
|
|
|
*/ |
|
45
|
2 |
|
public function register() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->app->singleton('swivel', function (Container $app) { |
|
48
|
2 |
|
$request = $app->make(\Illuminate\Http\Request::class); |
|
49
|
2 |
|
return new SwivelComponent($request); |
|
50
|
2 |
|
}); |
|
51
|
|
|
|
|
52
|
2 |
|
$this->app->alias('swivel', SwivelComponent::class); |
|
53
|
2 |
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Returns the configuration path for the component |
|
57
|
|
|
* |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
2 |
|
private function configPath() |
|
61
|
|
|
{ |
|
62
|
2 |
|
return realpath($raw = __DIR__ . '/../config/swivel.php') ?: $raw; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Setup the config. |
|
67
|
|
|
* |
|
68
|
|
|
* @param \Illuminate\Contracts\Container\Container $app The container |
|
69
|
|
|
* @return void |
|
70
|
|
|
*/ |
|
71
|
2 |
|
protected function setupConfig(Container $app) |
|
72
|
|
|
{ |
|
73
|
2 |
|
$source = $this->configPath(); |
|
74
|
|
|
|
|
75
|
2 |
|
if ($app instanceof LaravelApplication && $app->runningInConsole()) { |
|
76
|
2 |
|
$this->publishes([$source => config_path('swivel.php')]); |
|
77
|
|
|
} elseif ($app instanceof LumenApplication) { |
|
78
|
|
|
$app->configure('swivel'); |
|
|
|
|
|
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
2 |
|
$this->mergeConfigFrom($source, 'swivel'); |
|
82
|
2 |
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Get the services provided by the provider. |
|
86
|
|
|
* |
|
87
|
|
|
* @return array |
|
88
|
|
|
*/ |
|
89
|
|
|
public function provides() |
|
90
|
|
|
{ |
|
91
|
|
|
return ['swivel']; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
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