Completed
Pull Request — master (#6)
by Richan
01:26
created

UncacheableByVarnish   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
1
<?php
2
3
namespace RichanFongdasen\Varnishable\Middleware;
4
5
use Closure;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class UncacheableByVarnish
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param \Symfony\Component\HttpFoundation\Request $request
14
     * @param \Closure                                  $next
15
     *
16
     * @return mixed
17
     */
18
    public function handle(Request $request, Closure $next)
19
    {
20
        $response = $next($request);
21
22
        \Varnishable::addUncacheableHeader($response);
23
24
        return $response;
25
    }
26
}
27