1 | <?php |
||||
2 | |||||
3 | namespace ChaseConey\LaravelDatadogHelper\Middleware; |
||||
4 | |||||
5 | use Closure; |
||||
6 | use ChaseConey\LaravelDatadogHelper\Datadog; |
||||
7 | use Symfony\Component\HttpFoundation\Request; |
||||
0 ignored issues
–
show
|
|||||
8 | use Symfony\Component\HttpFoundation\Response; |
||||
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\Response 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 ![]() |
|||||
9 | |||||
10 | class LaravelDatadogMiddleware |
||||
11 | { |
||||
12 | |||||
13 | /** |
||||
14 | * @param $request |
||||
15 | * @param Closure $next |
||||
16 | * @return \Illuminate\Http\RedirectResponse |
||||
0 ignored issues
–
show
The type
Illuminate\Http\RedirectResponse 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 ![]() |
|||||
17 | */ |
||||
18 | public function handle($request, Closure $next) |
||||
19 | { |
||||
20 | $startTime = microtime(true); |
||||
21 | |||||
22 | $response = $next($request); |
||||
23 | |||||
24 | if (config('datadog-helper.enabled', false)) { |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
25 | static::logDuration($request, $response, $startTime); |
||||
26 | } |
||||
27 | |||||
28 | return $response; |
||||
29 | } |
||||
30 | |||||
31 | /** |
||||
32 | * Logs the duration of a specific request through the application |
||||
33 | * |
||||
34 | * @param Request $request |
||||
35 | * @param Response $response |
||||
36 | * @param double $startTime |
||||
37 | */ |
||||
38 | protected static function logDuration(Request $request, Response $response, $startTime) |
||||
39 | { |
||||
40 | $duration = microtime(true) - $startTime; |
||||
41 | |||||
42 | $tags = [ |
||||
43 | "status_code" => $response->getStatusCode() |
||||
44 | ]; |
||||
45 | |||||
46 | if (!config('datadog-helper.middleware_disable_url_tag', false)) { |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
47 | $tags["url"] = $request->getSchemeAndHttpHost() . $request->getRequestUri(); |
||||
48 | } |
||||
49 | |||||
50 | Datadog::microtiming('request_time', $duration, 1, $tags); |
||||
51 | } |
||||
52 | } |
||||
53 |
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