Issues (1019)

src/Components/Prometheus/RequestMiddleware.php (19 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace Hhxsv5\LaravelS\Components\Prometheus;
4
5
use Closure;
6
use Hhxsv5\LaravelS\Components\Prometheus\Collectors\HttpRequestCollector;
7
8
class RequestMiddleware
0 ignored issues
show
Missing doc comment for class RequestMiddleware
Loading history...
9
{
10
    private $collector;
0 ignored issues
show
Private member variable "collector" must be prefixed with an underscore
Loading history...
11
12
    public function __construct(HttpRequestCollector $collector)
0 ignored issues
show
Missing doc comment for function __construct()
Loading history...
13
    {
14
        $this->collector = $collector;
15
    }
16
17
    /**
18
     * Handle an incoming request.
19
     *
20
     * @param \Illuminate\Http\Request $request
0 ignored issues
show
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
Missing parameter comment
Loading history...
The type Illuminate\Http\Request 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
     * @param \Closure $next
0 ignored issues
show
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
Expected 17 spaces after parameter type; 1 found
Loading history...
Missing parameter comment
Loading history...
22
     * @return mixed
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
23
     */
24
    public function handle($request, Closure $next)
25
    {
26
        return $next($request);
27
    }
28
29
    /**
30
     * Handle tasks after the response has been sent to the browser.
31
     *
32
     * @param \Illuminate\Http\Request $request
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
Expected 2 spaces after parameter type; 1 found
Loading history...
33
     * @param \Illuminate\Http\Response $response
0 ignored issues
show
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
Missing parameter comment
Loading history...
The type Illuminate\Http\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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
34
     * @return void
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
35
     */
36
    public function terminate($request, $response)
37
    {
38
        try {
39
            $this->collector->collect([$request, $response]);
40
        } catch (\Exception $e) {
41
            app('log')->error('PrometheusMiddleware: failed to collect request metrics.', ['exception' => $e]);
0 ignored issues
show
The function app 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 ignore-call  annotation

41
            /** @scrutinizer ignore-call */ 
42
            app('log')->error('PrometheusMiddleware: failed to collect request metrics.', ['exception' => $e]);
Loading history...
42
        }
43
    }
44
}
45