This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of Laravel LogViewer. |
||
5 | * |
||
6 | * (c) Koss Shtukert <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace KossShtukert\LogViewer; |
||
13 | |||
14 | use Illuminate\Routing\Router; |
||
15 | use Illuminate\Support\ServiceProvider; |
||
16 | use KossShtukert\LogViewer\Http\Controllers\LogViewerController; |
||
17 | use KossShtukert\LogViewer\Log\Data; |
||
18 | use KossShtukert\LogViewer\Log\Factory; |
||
19 | use KossShtukert\LogViewer\Log\Filesystem; |
||
20 | |||
21 | /** |
||
22 | * This is the log viewer service provider class. |
||
23 | * |
||
24 | * @author Koss Shtukert <[email protected]> |
||
25 | */ |
||
26 | class LogViewerServiceProvider extends ServiceProvider |
||
27 | { |
||
28 | /** |
||
29 | * Boot the service provider. |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | 10 | public function boot() |
|
34 | { |
||
35 | 10 | $this->setupPackage(); |
|
36 | |||
37 | 10 | $this->setupRoutes($this->app->router); |
|
0 ignored issues
–
show
|
|||
38 | 10 | } |
|
39 | |||
40 | /** |
||
41 | * Setup the package. |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | 10 | protected function setupPackage() |
|
46 | { |
||
47 | 10 | $source = realpath(__DIR__ . '/../config/logviewer.php'); |
|
48 | |||
49 | 10 | $this->publishes([$source => config_path('logviewer.php')], 'config'); |
|
50 | 10 | $this->publishes([ |
|
51 | 10 | realpath(__DIR__ . '/../assets/css') => public_path('assets/styles'), |
|
52 | 10 | realpath(__DIR__ . '/../assets/js') => public_path('assets/scripts'), |
|
53 | 10 | ], 'public'); |
|
54 | |||
55 | 10 | $this->mergeConfigFrom($source, 'logviewer'); |
|
56 | |||
57 | 10 | $this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'logviewer'); |
|
58 | 10 | } |
|
59 | |||
60 | /** |
||
61 | * Setup the routes. |
||
62 | * |
||
63 | * @param \Illuminate\Routing\Router $router |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | 10 | protected function setupRoutes(Router $router) |
|
68 | { |
||
69 | $router->group(['namespace' => 'KossShtukert\LogViewer\Http\Controllers'], function (Router $router) { |
||
70 | 10 | require __DIR__ . '/Http/routes.php'; |
|
71 | 10 | }); |
|
72 | 10 | } |
|
73 | |||
74 | /** |
||
75 | * Register the service provider. |
||
76 | * |
||
77 | * @return void |
||
78 | */ |
||
79 | 10 | public function register() |
|
80 | { |
||
81 | 10 | $this->registerLogData(); |
|
82 | 10 | $this->registerLogFilesystem(); |
|
83 | 10 | $this->registerLogFactory(); |
|
84 | |||
85 | 10 | $this->registerLogViewer(); |
|
86 | |||
87 | 10 | $this->registerLogViewerController(); |
|
88 | 10 | } |
|
89 | |||
90 | /** |
||
91 | * Register the log data class. |
||
92 | * |
||
93 | * @return void |
||
94 | */ |
||
95 | 10 | protected function registerLogData() |
|
96 | { |
||
97 | $this->app->singleton('logviewer.data', function () { |
||
98 | 4 | return new Data(); |
|
99 | 10 | }); |
|
100 | |||
101 | 10 | $this->app->alias('logviewer.data', Data::class); |
|
102 | 10 | } |
|
103 | |||
104 | /** |
||
105 | * Register the log filesystem class. |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | 10 | protected function registerLogFilesystem() |
|
110 | { |
||
111 | $this->app->singleton('logviewer.filesystem', function ($app) { |
||
112 | 4 | $files = $app['files']; |
|
113 | 4 | $path = $app['path.storage'] . '/logs'; |
|
114 | |||
115 | 4 | return new Filesystem($files, $path); |
|
116 | 10 | }); |
|
117 | |||
118 | 10 | $this->app->alias('logviewer.filesystem', Filesystem::class); |
|
119 | 10 | } |
|
120 | |||
121 | /** |
||
122 | * Register the log factory class. |
||
123 | * |
||
124 | * @return void |
||
125 | */ |
||
126 | 10 | protected function registerLogFactory() |
|
127 | { |
||
128 | $this->app->singleton('logviewer.factory', function ($app) { |
||
129 | 3 | $filesystem = $app['logviewer.filesystem']; |
|
130 | 3 | $levels = $app['logviewer.data']->levels(); |
|
131 | |||
132 | 3 | return new Factory($filesystem, $levels); |
|
133 | 10 | }); |
|
134 | |||
135 | 10 | $this->app->alias('logviewer.factory', Factory::class); |
|
136 | 10 | } |
|
137 | |||
138 | /** |
||
139 | * Register the log data class. |
||
140 | * |
||
141 | * @return void |
||
142 | */ |
||
143 | 10 | protected function registerLogViewer() |
|
144 | { |
||
145 | $this->app->singleton('logviewer', function ($app) { |
||
146 | 2 | $factory = $app['logviewer.factory']; |
|
147 | 2 | $filesystem = $app['logviewer.filesystem']; |
|
148 | 2 | $data = $app['logviewer.data']; |
|
149 | |||
150 | 2 | return new LogViewer($factory, $filesystem, $data); |
|
151 | 10 | }); |
|
152 | |||
153 | 10 | $this->app->alias('logviewer', LogViewer::class); |
|
154 | 10 | } |
|
155 | |||
156 | /** |
||
157 | * Register the log viewer controller class. |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | protected function registerLogViewerController() |
||
162 | { |
||
163 | 10 | $this->app->bind(LogViewerController::class, function ($app) { |
|
164 | $perPage = $app['config']['logviewer.per_page']; |
||
165 | $middleware = $app['config']['logviewer.middleware']; |
||
166 | |||
167 | return new LogViewerController($perPage, $middleware); |
||
168 | 10 | }); |
|
169 | 10 | } |
|
170 | |||
171 | /** |
||
172 | * Get the services provided by the provider. |
||
173 | * |
||
174 | * @return string[] |
||
175 | */ |
||
176 | 2 | public function provides() |
|
177 | { |
||
178 | return [ |
||
179 | 2 | 'logviewer', |
|
180 | 2 | 'logviewer.data', |
|
181 | 2 | 'logviewer.factory', |
|
182 | 2 | 'logviewer.filesystem', |
|
183 | 2 | ]; |
|
184 | } |
||
185 | } |
||
186 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: