Completed
Push — develop ( 9a08bc...c3dea4 )
by Sean
02:58
created

QueryString::setKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of jwt-auth
5
 *
6
 * (c) Sean Tymon <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tymon\JWTAuth\Http;
13
14
use Illuminate\Http\Request;
15
use Illuminate\Contracts\Http\Parser as ParserContract;
16
17
class QueryString implements ParserContract
18
{
19
20
    /**
21
     * The query string key
22
     *
23
     * @var string
24
     */
25
    protected $key = 'token';
26
27
    /**
28
     * Try to parse the token from the request query string
29
     *
30
     * @param Illuminate\Http\Request $request
31
     *
32
     * @return null|string
33
     */
34
    public function parse(Request $request)
35
    {
36
        return $request->input($this->key);
37
    }
38
39
    /**
40
     * Set the query string key
41
     *
42
     * @param  string  $key
43
     *
44
     * @return QueryString
45
     */
46
    public function setKey($key)
47
    {
48
        $this->key = $key;
49
50
        return $this;
51
    }
52
}
53