Automattic\WooCommerce\Vendor\GraphQL\Language
Source::__construct
A representation of source input to GraphQL.
name and locationOffset are optional. They are useful for clients who store Automattic\WooCommerce\Vendor\GraphQL documents in source files; for example, if the Automattic\WooCommerce\Vendor\GraphQL input starts at line 40 in a file named Foo.graphql, it might be useful for name to be "Foo.graphql" and location to be { line: 40, column: 0 }. line and column in locationOffset are 1-indexed
Method of the class: Source{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Source = new Source(); $Source->__construct( $body, ?string $name, ?SourceLocation $location );
- $body(string) (required)
- .
- ?string $name
- .
Default:null - ?SourceLocation $location
- .
Default:null
Source::__construct() Source:: construct code WC 10.9.1
public function __construct(string $body, ?string $name = null, ?SourceLocation $location = null)
{
$this->body = $body;
$this->length = mb_strlen($body, 'UTF-8');
$this->name = $name === '' || $name === null
? 'Automattic\WooCommerce\Vendor\GraphQL request'
: $name;
$this->locationOffset = $location ?? new SourceLocation(1, 1);
}