public static function fromArray(array $data): Time
    {
        if (!isset($data['hours'])) {
            throw new \InvalidArgumentException('Array is not valid.');
        }

        return new Time(
            $data['hours'],
            $data['minutes'] ?? 0,
            $data['seconds'] ?? 0
        );
    }