Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
LocationRange
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 __toString
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Wikimedia\WikiPEG;
4
5class LocationRange implements \JsonSerializable {
6    /** @var Location */
7    public $start;
8
9    /** @var Location */
10    public $end;
11
12    /**
13     * @param int $startOffset
14     * @param int $startLine
15     * @param int $startColumn
16     * @param int $endOffset
17     * @param int $endLine
18     * @param int $endColumn
19     */
20    public function __construct( $startOffset, $startLine, $startColumn, $endOffset, $endLine, $endColumn ) {
21        $this->start = new Location( $startOffset, $startLine, $startColumn );
22        $this->end = new Location( $endOffset, $endLine, $endColumn );
23    }
24
25    /** @return string */
26    public function __toString() {
27        return "{$this->start}-{$this->end}";
28    }
29
30    /**
31     * Emit a JSON serialization similar to JS, for testing
32     * @return array
33     */
34    #[\ReturnTypeWillChange]
35    public function jsonSerialize(): array {
36        return [
37            'start' => $this->start,
38            'end' => $this->end,
39        ];
40    }
41}