39 lines
686 B
PHP
39 lines
686 B
PHP
<?php
|
|
|
|
namespace LanguageServer\Protocol;
|
|
|
|
use PhpParser\Node;
|
|
|
|
/**
|
|
* Represents a location inside a resource, such as a line inside a text file.
|
|
*/
|
|
class Location
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $uri;
|
|
|
|
/**
|
|
* @var Range
|
|
*/
|
|
public $range;
|
|
|
|
/**
|
|
* Returns the location of the node
|
|
*
|
|
* @param Node $node
|
|
* @return self
|
|
*/
|
|
public static function fromNode(Node $node)
|
|
{
|
|
return new self($node->getAttribute('ownerDocument')->getUri(), Range::fromNode($node));
|
|
}
|
|
|
|
public function __construct(string $uri = null, Range $range = null)
|
|
{
|
|
$this->uri = $uri;
|
|
$this->range = $range;
|
|
}
|
|
}
|