Completed
Push — master ( 9fde6d...5740e8 )
by Rafael
03:53
created

InvalidTypeException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 26
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isClientSafe() 0 3 1
A getCategory() 0 3 1
A __construct() 0 3 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[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
namespace Ynlo\GraphQLBundle\Type\Registry;
12
13
use GraphQL\Error\ClientAware;
14
15
/**
16
 * This exception happen when some type definition does not exist in current endpoint.
17
 * Commonly happen for invalid schema in the server side or if the client are trying to send a request not
18
 * existent in current endpoint. In any case should be treated as `graphql` error and client safe
19
 */
20
class InvalidTypeException extends \UnexpectedValueException implements ClientAware
21
{
22
    /**
23
     * InvalidTypeException constructor.
24
     *
25
     * @param string $type
26
     */
27
    public function __construct($type)
28
    {
29
        parent::__construct(sprintf('Can`t find a valid type for "%s"', $type));
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public function isClientSafe()
36
    {
37
        return true;
38
    }
39
40
    /**
41
     * @inheritDoc
42
     */
43
    public function getCategory()
44
    {
45
        return 'graphql';
46
    }
47
}
48