Completed
Push — master ( 41116d...43e4d4 )
by
unknown
13:57
created

ErrorFactory::buildUnacceptable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 16

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
dl 18
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 5
1
<?php
2
3
namespace RealPage\JsonApi;
4
5
use Neomerx\JsonApi\Document\Link;
6
use Neomerx\JsonApi\Document\Error;
7
use Neomerx\JsonApi\Contracts\Document\LinkInterface;
8
9
class ErrorFactory
10
{
11 View Code Duplication
    public static function buildUnsupportedMediaType(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
        $id = null,
13
        LinkInterface $aboutLink = null,
14
        $code = null,
15
        array $source = null,
16
        $meta = null
17
    ): Error {
18
        return new Error(
19
            $id ?? null,
20
            $aboutLink ?? new Link('http://jsonapi.org/format/#content-negotiation-clients'),
21
            '415',
22
            $code ?? null,
23
            'Unsupported Media Type',
24
            'Content-Type of a request containing JSON data must be application/vnd.api+json',
25
            $source,
26
            $meta
27
        );
28
    }
29
30 View Code Duplication
    public static function buildUnacceptable(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
        $id = null,
32
        LinkInterface $aboutLink = null,
33
        $code = null,
34
        array $source = null,
35
        $meta = null
36
    ): Error {
37
        return new Error(
38
            $id ?? null,
39
            $aboutLink ?? new Link('http://jsonapi.org/format/#content-negotiation-clients'),
40
            '406',
41
            $code ?? null,
42
            'Not Acceptable',
43
            'Accept header must accept application/vnd.api+json at least once without parameters',
44
            $source,
45
            $meta
46
        );
47
    }
48
}
49