Lines 0.00% 0 / 3
Functions and Methods 0.00% 0 / 1
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
SunError 0.00% 0 / 3 0.00% 0 / 1 12 0.00% 0 / 1
 messageTemplate 0.00% 0 / 3 0.00% 0 / 1 12
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Contracts\Exception;
6
7enum SunError: string implements ExceptionReason
8{
9    case CoordinateOutOfRange = 'coordinate_out_of_range';
10    case LocationUnknown = 'location_unknown';
11
12    public function messageTemplate(): string
13    {
14        return match ($this) {
15            self::CoordinateOutOfRange => 'The {coordinate} {value} is outside -{limit} to {limit}.',
16            self::LocationUnknown => 'Home Assistant reported no location, so sun times are unknown.',
17        };
18    }
19}