File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,19 @@ public static function firstValue(array $array)
4949 return $ array [$ key ];
5050 }
5151
52+ /**
53+ * @param mixed[] $values
54+ * @return mixed[]
55+ */
56+ public static function castValueToType (array $ values , string $ type ): array
57+ {
58+ return array_map (function ($ value ) use ($ type ) {
59+ settype ($ value , $ type );
60+
61+ return $ value ;
62+ }, $ values );
63+ }
64+
5265 /**
5366 * @param mixed[] $previous
5467 * @param mixed[] $current
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Utilitte \Php ;
4+
5+ use DateTime ;
6+
7+ final class DateTimeComparator
8+ {
9+
10+ private DateTime $ dateTime ;
11+
12+ public function __construct (DateTime $ dateTime )
13+ {
14+ $ this ->dateTime = $ dateTime ;
15+ }
16+
17+ public function isSameDate (DateTime $ dateTime ): bool
18+ {
19+ return $ this ->dateTime ->format ('Y-m-d ' ) === $ dateTime ->format ('Y-m-d ' );
20+ }
21+
22+ }
You can’t perform that action at this time.
0 commit comments