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

tempestphp / tempest-framework / 14024978163

23 Mar 2025 05:55PM UTC coverage: 79.391% (-0.05%) from 79.441%
14024978163

push

github

web-flow
feat(view): cache Blade and Twig templates in internal storage (#1061)

2 of 2 new or added lines in 2 files covered. (100.0%)

912 existing lines in 110 files now uncovered.

10478 of 13198 relevant lines covered (79.39%)

91.09 hits per line

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

92.31
/src/Tempest/Validation/src/Rules/DateTimeFormat.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Validation\Rules;
6

7
use Attribute;
8
use DateTime;
9
use DateTimeInterface;
10
use Tempest\Validation\Rule;
11

12
#[Attribute]
13
final readonly class DateTimeFormat implements Rule
14
{
15
    public const string FORMAT = 'Y-m-d H:i:s';
16

17
    public function __construct(
5✔
18
        public string $format = self::FORMAT,
19
    ) {
20
    }
5✔
21

22
    public function isValid(mixed $value): bool
3✔
23
    {
24
        $value = match ($value instanceof DateTimeInterface) {
3✔
UNCOV
25
            true => $value->format($this->format),
×
26
            default => $value,
3✔
27
        };
3✔
28

29
        if (! is_string($value) || ! $value) {
3✔
30
            return false;
2✔
31
        }
32

33
        $date = DateTime::createFromFormat($this->format, $value);
2✔
34

35
        return $date && $date->format($this->format) === $value;
2✔
36
    }
37

38
    public function message(): string
1✔
39
    {
40
        return "Value should be a valid datetime in the format {$this->format}";
1✔
41
    }
42
}
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