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 ( a74bc8...6e7b49 )
by Sergey
03:20
created

ResponseFactory   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 55.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 80
ccs 10
cts 18
cp 0.5556
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getEncoder() 0 4 1
A getUrlPrefix() 0 4 1
A getEncodingParameters() 0 4 1
A getSchemaContainer() 0 4 1
A __construct() 0 5 1
A createResponse() 0 4 1
A getSupportedExtensions() 0 4 1
A getMediaType() 0 4 1
1
<?php
2
/*
3
 * This file is part of the reva2/jsonapi.
4
 *
5
 * (c) Sergey Revenko <[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;
13
14
use Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface;
15
use Neomerx\JsonApi\Http\Responses;
16
use Reva2\JsonApi\Contracts\Services\EnvironmentInterface;
17
use Symfony\Component\HttpFoundation\Response;
18
19
/**
20
 * JSON API response factory
21
 *
22
 * @package Reva2\JsonApi\Http
23
 * @author Sergey Revenko <[email protected]>
24
 */
25
class ResponseFactory extends Responses
26
{
27
    /**
28
     * @var EnvironmentInterface
29
     */
30
    protected $environment;
31
32
    /**
33
     * @var EncodingParametersInterface
34
     */
35
    protected $params;
36
37
    /**
38
     * Constructor
39
     *
40
     * @param EnvironmentInterface $environment
41
     * @param EncodingParametersInterface|null $params
42
     */
43 1
    public function __construct(EnvironmentInterface $environment, EncodingParametersInterface $params = null)
44
    {
45 1
        $this->environment = $environment;
46 1
        $this->params = $params;
47 1
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52 1
    protected function createResponse($content, $statusCode, array $headers)
53
    {
54 1
        return new Response($content, $statusCode, $headers);
55
    }
56
57
    /**
58
     * @inheritdoc
59
     */
60
    protected function getEncoder()
61
    {
62
        return $this->environment->getEncoder();
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    protected function getUrlPrefix()
69
    {
70
        return $this->environment->getUrlPrefix();
71
    }
72
73
    /**
74
     * @inheritdoc
75
     */
76
    protected function getEncodingParameters()
77
    {
78
        return $this->params;
79
    }
80
81
    /**
82
     * @inheritdoc
83
     */
84
    protected function getSchemaContainer()
85
    {
86
        return $this->environment->getSchemaContainer();
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92 1
    protected function getSupportedExtensions()
93
    {
94 1
        return null;
95
    }
96
97
    /**
98
     * @inheritdoc
99
     */
100 1
    protected function getMediaType()
101
    {
102 1
        return $this->environment->getEncoderMediaType();
103
    }
104
}