• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

h4kuna / data-type / 9206014930

23 May 2024 09:59AM UTC coverage: 97.017% (+0.02%) from 96.994%
9206014930

push

github

h4kuna
feat(Math): method interval support DatetimeInterface

9 of 10 new or added lines in 2 files covered. (90.0%)

1 existing line in 1 file now uncovered.

618 of 637 relevant lines covered (97.02%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/Date/Interval.php
1
<?php declare(strict_types=1);
2

3
namespace h4kuna\DataType\Date;
4

5
use DateInterval;
6
use DateTimeInterface;
7
use h4kuna\DataType\Number\Math;
8
use Nette\Utils\DateTime;
9

10
final class Interval
11
{
12
        public static function toSeconds(DateInterval $dateInterval): int
1✔
13
        {
14
                return ((int) $dateInterval->days) * DateTime::DAY
1✔
15
                        + $dateInterval->h * DateTime::HOUR
1✔
16
                        + $dateInterval->i * DateTime::MINUTE
1✔
17
                        + $dateInterval->s;
1✔
18
        }
19

20

21
        public static function interval(
22
                DateTimeInterface $date,
23
                ?DateTimeInterface $from,
24
                ?DateTimeInterface $to = null
25
        ): DateTimeInterface
26
        {
NEW
27
                return Math::interval($date, $to, $from);
×
28
        }
29
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc