Completed
Push — master ( 812692...5d2ed7 )
by Ivan
07:38
created

UrlDetector::shouldValidate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace CodeZero\Localizer\Detectors;
4
5
use Illuminate\Support\Facades\Config;
6
use Illuminate\Support\Facades\Request;
7
8
class UrlDetector implements Detector
9
{
10
    /**
11
     * Detect the locale.
12
     *
13
     * @return string|array|null
14
     */
15 7
    public function detect()
16
    {
17 7
        $position = Config::get('localizer.url-segment');
18
19 7
        return Request::segment($position);
20
    }
21
22
    /**
23
     * Should the detected locale be validated
24
     * as a supported locale?
25
     *
26
     * @return bool
27
     */
28 7
    public function shouldValidate()
29
    {
30 7
        return true;
31
    }
32
}
33