Completed
Pull Request — master (#24)
by David
01:56
created

FieldNotFoundException::missingField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers;
5
6
7
class FieldNotFoundException extends \RuntimeException
8
{
9
    public static function missingField(string $className, string $fieldName): self
10
    {
11
        throw new self(sprintf('Could not find a getter or a isser for field "%s". Looked for: "%s::get%s()", "%s::is%s()"',
12
            $fieldName, $className, \ucfirst($fieldName), $className, \ucfirst($fieldName)));
13
    }
14
15
    public static function wrapWithCallerInfo(self $e, string $className): self
16
    {
17
        throw new self(sprintf('There is an issue with a @SourceField annotation in class "%s": %s',
18
            $className, $e->getMessage()), 0, $e);
19
    }
20
}
21