GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0db238...98ac49 )
by Sergey
09:41
created

QueryParametersParser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 12 3
A setDataParser() 0 6 1
A setQueryType() 0 6 1
1
<?php
2
/*
3
 * This file is part of the reva2/jsonapi.
4
 *
5
 * (c) OrbitScripts LLC <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
12
namespace Reva2\JsonApi\Http\Query;
13
14
use Psr\Http\Message\ServerRequestInterface;
15
use Reva2\JsonApi\Contracts\Decoders\DataParserInterface;
16
use Reva2\JsonApi\Contracts\Http\Query\QueryParametersParserInterface;
17
18
/**
19
 * Query parameters parser
20
 *
21
 * @package Reva2\JsonApi\Http\Query
22
 * @author Sergey Revenko <[email protected]>
23
 */
24
class QueryParametersParser implements QueryParametersParserInterface
25
{
26
    /**
27
     * @var DataParserInterface
28
     */
29
    protected $parser;
30
31
    /**
32
     * @var string|null
33
     */
34
    protected $queryType;
35
36
    /**
37
     * @inheritdoc
38
     */
39 3
    public function parse(ServerRequestInterface $request)
40
    {
41 3
        if (null === $this->parser) {
42 1
            throw new \RuntimeException('Data parser not specified');
43
        }
44
45 2
        if (null === $this->queryType) {
46 1
            throw new \RuntimeException('Query type not specified');
47
        }
48
49 1
        return $this->parser->parseQueryParams($request->getQueryParams(), $this->queryType);
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55 2
    public function setDataParser(DataParserInterface $parser)
56
    {
57 2
        $this->parser = $parser;
58
59 2
        return $this;
60
    }
61
62
    /**
63
     * @inheritdoc
64
     */
65 1
    public function setQueryType($type)
66
    {
67 1
        $this->queryType = $type;
68
69 1
        return $this;
70
    }
71
}
72