aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/CharacterRange.php
blob: b2d296833d7f7c7e289e1a3e772b10df9c74037c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
namespace Digitigrade;

class CharacterRange implements \JsonSerializable {
    public int $start;
    public int $end;

    public function __construct(string $range) {
        $parts = explode('-', $range, 2);
        $this->start = +$parts[0];
        $this->end = +$parts[1];
    }

    public function jsonSerialize(): string {
        return "$this->start-$this->end";
    }
}