GraphQL\Error\Error::getSource PHP Метод

getSource() публичный Метод

public getSource ( ) : Source | null
Результат GraphQL\Language\Source | null
    public function getSource()
    {
        if (null === $this->source) {
            if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) {
                $this->source = $this->nodes[0]->loc->source;
            }
        }
        return $this->source;
    }

Usage Example

Пример #1
0
 /**
  * @it converts source and positions to locations
  */
 public function testConvertsSourceAndPositionsToLocations()
 {
     $source = new Source('{
   field
 }');
     $e = new Error('msg', null, $source, [10]);
     $this->assertEquals(null, $e->nodes);
     $this->assertEquals($source, $e->getSource());
     $this->assertEquals([10], $e->getPositions());
     $this->assertEquals([new SourceLocation(2, 9)], $e->getLocations());
 }