Passed
Push — master ( 5c0c69...46ba0d )
by Georgi
03:26
created

NoCacheHeaders   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 1
1
<?php
2
3
namespace Epesi\Core\Middleware;
4
5
use Closure;
6
7
class NoCacheHeaders
8
{
9
    /**
10
     * Add cache related HTTP headers.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @param  \Closure  $next
14
     * @param  string|array  $options
15
     * @return \Symfony\Component\HttpFoundation\Response
16
     *
17
     * @throws \InvalidArgumentException
18
     */
19
    public function handle($request, Closure $next, $options = [])
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
    public function handle($request, Closure $next, /** @scrutinizer ignore-unused */ $options = [])

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
    {
21
        $response = $next($request);
22
23
        $response->headers->addCacheControlDirective('no-cache', true);
24
        $response->headers->addCacheControlDirective('max-age', 0);
25
        $response->headers->addCacheControlDirective('must-revalidate', true);
26
        $response->headers->addCacheControlDirective('no-store', true);
27
        
28
        return $response;
29
    }
30
}
31