Completed
Push — master ( fbfec6...5d8274 )
by Elf
05:33
created

CheckAppClient   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 26
ccs 0
cts 14
cp 0
rs 10
wmc 5
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B handle() 0 16 5
1
<?php
2
3
namespace ElfSundae\Laravel\Support\Http\Middleware;
4
5
use Closure;
6
use ElfSundae\Laravel\Agent\Facades\AgentClient;
7
8
class CheckAppClient
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param  \Illuminate\Http\Request  $request
14
     * @param  \Closure  $next
15
     * @return mixed
16
     */
17
    public function handle($request, Closure $next)
18
    {
19
        if (! AgentClient::is('AppClient')) {
20
            return response('Unauthorized Client', 403);
21
        }
22
23
        if (
24
            AgentClient::is('iOS') &&
25
            AgentClient::appChannel('App Store') &&
26
            AgentClient::get('appVersion') === config('var.ios.app_store_reviewing_version')
27
        ) {
28
            AgentClient::set('isAppStoreReviewing', true);
29
        }
30
31
        return $next($request);
32
    }
33
}
34