class SourceLocation
This class represents a location in the source code with start and end position.
@author Marco Marchiò <marco.mm89@gmail.com>
Hierarchy
- class \Peast\Syntax\SourceLocation implements \Peast\Syntax\JSONSerializable
Expanded class hierarchy of SourceLocation
1 file declares its use of SourceLocation
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ SourceLocation.php, line 18
Namespace
Peast\SyntaxView source
class SourceLocation implements \JSONSerializable {
/**
* Start position
*
* @var Position
*/
public $start;
/**
* End position
*
* @var Position
*/
public $end;
/**
* Returns the start position
*
* @return Position
*/
public function getStart() {
return $this->start;
}
/**
* Sets the start position
*
* @param Position $position Start position
*
* @return $this
*/
public function setStart(Position $position) {
$this->start = $position;
return $this;
}
/**
* Returns the end position
*
* @return Position
*/
public function getEnd() {
return $this->end;
}
/**
* Sets the end position
*
* @param Position $position End position
*
* @return $this
*/
public function setEnd(Position $position) {
$this->end = $position;
return $this;
}
/**
* Returns a serializable version of the object
*
* @return array
*/
public function jsonSerialize() {
return array(
"start" => $this->start,
"end" => $this->end,
);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
SourceLocation::$end | public | property | End position |
SourceLocation::$start | public | property | Start position |
SourceLocation::getEnd | public | function | Returns the end position |
SourceLocation::getStart | public | function | Returns the start position |
SourceLocation::jsonSerialize | public | function | Returns a serializable version of the object |
SourceLocation::setEnd | public | function | Sets the end position |
SourceLocation::setStart | public | function | Sets the start position |