Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/SourceLocation.php

raw
1 <?php
2 /**
3 * This file is part of the Peast package
4 *
5 * (c) Marco Marchiò <[email protected]>
6 *
7 * For the full copyright and license information refer to the LICENSE file
8 * distributed with this source code
9 */
10 namespace Peast\Syntax;
11
12 /**
13 * This class represents a location in the source code with start and end
14 * position.
15 *
16 * @author Marco Marchiò <[email protected]>
17 */
18 class SourceLocation implements \JSONSerializable
19 {
20 /**
21 * Start position
22 *
23 * @var Position
24 */
25 public $start;
26
27 /**
28 * End position
29 *
30 * @var Position
31 */
32 public $end;
33
34 /**
35 * Returns the start position
36 *
37 * @return Position
38 */
39 public function getStart()
40 {
41 return $this->start;
42 }
43
44 /**
45 * Sets the start position
46 *
47 * @param Position $position Start position
48 *
49 * @return $this
50 */
51 public function setStart(Position $position)
52 {
53 $this->start = $position;
54 return $this;
55 }
56
57 /**
58 * Returns the end position
59 *
60 * @return Position
61 */
62 public function getEnd()
63 {
64 return $this->end;
65 }
66
67 /**
68 * Sets the end position
69 *
70 * @param Position $position End position
71 *
72 * @return $this
73 */
74 public function setEnd(Position $position)
75 {
76 $this->end = $position;
77 return $this;
78 }
79
80 /**
81 * Returns a serializable version of the object
82 *
83 * @return array
84 */
85 #[\ReturnTypeWillChange]
86 public function jsonSerialize()
87 {
88 return array(
89 "start" => $this->start,
90 "end" => $this->end
91 );
92 }
93 }