Passed
Pull Request — master (#76)
by David
02:11
created

missingLimit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers\Mappers;
5
6
7
use Exception;
8
use GraphQL\Error\ClientAware;
9
10
class PorpaginasMissingParameterException extends Exception implements ClientAware, CannotMapTypeExceptionInterface
11
{
12
    public static function missingLimit(): self
13
    {
14
        return new self('In the items field of a result set, you cannot add a "offset" without also adding a "limit"');
15
    }
16
17
    public static function noSubType()
18
    {
19
        return new self('Result sets implementing Porpaginas need to have a subtype. Please define it using @return annotation. For instance: "@return User[]"');
20
    }
21
22
    /**
23
     * Returns true when exception message is safe to be displayed to a client.
24
     *
25
     * @return bool
26
     *
27
     * @api
28
     */
29
    public function isClientSafe()
30
    {
31
        return true;
32
    }
33
34
    /**
35
     * Returns string describing a category of the error.
36
     *
37
     * Value "graphql" is reserved for errors produced by query parsing or validation, do not use it.
38
     *
39
     * @return string
40
     *
41
     * @api
42
     */
43
    public function getCategory()
44
    {
45
        return 'pagination';
46
    }
47
}