Completed
Push — master ( 3977d8...7ec8b3 )
by David
15s queued 11s
created

PorpaginasMissingParameterException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCategory() 0 3 1
A missingLimit() 0 3 1
A isClientSafe() 0 3 1
A noSubType() 0 3 1
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
}