Skip to content

Commit 0600c3e

Browse files
Check if variable in array is set
1 parent 8f03ca3 commit 0600c3e

File tree

1 file changed

+72
-72
lines changed

1 file changed

+72
-72
lines changed

src/Literals/Literal.php

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -280,35 +280,35 @@ public static function dateTimeYMD($year, $month = null, $day = null, $hour = nu
280280

281281
$map = ["year" => $year];
282282

283-
if ($month !== null) {
283+
if (isset($variables["month"])) {
284284
$map["month"] = $variables["month"];
285285
}
286286

287-
if ($day !== null) {
287+
if (isset($variables["day"])) {
288288
$map["day"] = $variables["day"];
289289
}
290290

291-
if ($hour !== null) {
291+
if (isset($variables["hour"])) {
292292
$map["hour"] = $variables["hour"];
293293
}
294294

295-
if ($minute !== null) {
295+
if (isset($variables["minute"])) {
296296
$map["minute"] = $variables["minute"];
297297
}
298298

299-
if ($second !== null) {
299+
if (isset($variables["second"])) {
300300
$map["second"] = $variables["second"];
301301
}
302302

303-
if ($millisecond !== null) {
303+
if (isset($variables["millisecond"])) {
304304
$map["millisecond"] = $variables["millisecond"];
305305
}
306306

307-
if ($microsecond !== null) {
307+
if (isset($variables["microsecond"])) {
308308
$map["microsecond"] = $variables["microsecond"];
309309
}
310310

311-
if ($nanosecond !== null) {
311+
if (isset($variables["nanosecond"])) {
312312
$map["nanosecond"] = $variables["nanosecond"];
313313
}
314314

@@ -359,35 +359,35 @@ public static function datetimeYWD($year, $week = null, $dayOfWeek = null, $hour
359359

360360
$map = ["year" => $year];
361361

362-
if ($week !== null) {
362+
if (isset($variables["week"])) {
363363
$map["week"] = $variables["week"];
364364
}
365365

366-
if ($dayOfWeek !== null) {
366+
if (isset($variables["dayOfWeek"])) {
367367
$map["dayOfWeek"] = $variables["dayOfWeek"];
368368
}
369369

370-
if ($hour !== null) {
370+
if (isset($variables["hour"])) {
371371
$map["hour"] = $variables["hour"];
372372
}
373373

374-
if ($minute !== null) {
374+
if (isset($variables["minute"])) {
375375
$map["minute"] = $variables["minute"];
376376
}
377377

378-
if ($second !== null) {
378+
if (isset($variables["second"])) {
379379
$map["second"] = $variables["second"];
380380
}
381381

382-
if ($millisecond !== null) {
382+
if (isset($variables["millisecond"])) {
383383
$map["millisecond"] = $variables["millisecond"];
384384
}
385385

386-
if ($microsecond !== null) {
386+
if (isset($variables["microsecond"])) {
387387
$map["microsecond"] = $variables["microsecond"];
388388
}
389389

390-
if ($nanosecond !== null) {
390+
if (isset($variables["nanosecond"])) {
391391
$map["nanosecond"] = $variables["nanosecond"];
392392
}
393393

@@ -437,35 +437,35 @@ public static function datetimeYQD($year, $quarter = null, $dayOfQuarter = null,
437437

438438
$map = ["year" => $year];
439439

440-
if ($quarter !== null) {
440+
if (isset($variables["quarter"])) {
441441
$map["quarter"] = $variables["quarter"];
442442
}
443443

444-
if ($dayOfQuarter !== null) {
444+
if (isset($variables["dayOfQuarter"])) {
445445
$map["dayOfQuarter"] = $variables["dayOfQuarter"];
446446
}
447447

448-
if ($hour !== null) {
448+
if (isset($variables["hour"])) {
449449
$map["hour"] = $variables["hour"];
450450
}
451451

452-
if ($minute !== null) {
452+
if (isset($variables["minute"])) {
453453
$map["minute"] = $variables["minute"];
454454
}
455455

456-
if ($second !== null) {
456+
if (isset($variables["second"])) {
457457
$map["second"] = $variables["second"];
458458
}
459459

460-
if ($millisecond !== null) {
460+
if (isset($variables["millisecond"])) {
461461
$map["millisecond"] = $variables["millisecond"];
462462
}
463463

464-
if ($microsecond !== null) {
464+
if (isset($variables["microsecond"])) {
465465
$map["microsecond"] = $variables["microsecond"];
466466
}
467467

468-
if ($nanosecond !== null) {
468+
if (isset($variables["nanosecond"])) {
469469
$map["nanosecond"] = $variables["nanosecond"];
470470
}
471471

@@ -513,31 +513,31 @@ public static function datetimeYD($year, $ordinalDay = null, $hour = null, $minu
513513

514514
$map = ["year" => $year];
515515

516-
if ($ordinalDay !== null) {
516+
if (isset($variables["ordinalDay"])) {
517517
$map["ordinalDay"] = $variables["ordinalDay"];
518518
}
519519

520-
if ($hour !== null) {
520+
if (isset($variables["hour"])) {
521521
$map["hour"] = $variables["hour"];
522522
}
523523

524-
if ($minute !== null) {
524+
if (isset($variables["minute"])) {
525525
$map["minute"] = $variables["minute"];
526526
}
527527

528-
if ($second !== null) {
528+
if (isset($variables["second"])) {
529529
$map["second"] = $variables["second"];
530530
}
531531

532-
if ($millisecond !== null) {
532+
if (isset($variables["millisecond"])) {
533533
$map["millisecond"] = $variables["millisecond"];
534534
}
535535

536-
if ($microsecond !== null) {
536+
if (isset($variables["microsecond"])) {
537537
$map["microsecond"] = $variables["microsecond"];
538538
}
539539

540-
if ($nanosecond !== null) {
540+
if (isset($variables["nanosecond"])) {
541541
$map["nanosecond"] = $variables["nanosecond"];
542542
}
543543

@@ -618,35 +618,35 @@ public static function localDatetimeYMD($year, $month = null, $day = null, $hour
618618

619619
$map = ["year" => $year];
620620

621-
if ($month !== null) {
621+
if (isset($variables["month"])) {
622622
$map["month"] = $variables["month"];
623623
}
624624

625-
if ($day !== null) {
625+
if (isset($variables["day"])) {
626626
$map["day"] = $variables["day"];
627627
}
628628

629-
if ($hour !== null) {
629+
if (isset($variables["hour"])) {
630630
$map["hour"] = $variables["hour"];
631631
}
632632

633-
if ($minute !== null) {
633+
if (isset($variables["minute"])) {
634634
$map["minute"] = $variables["minute"];
635635
}
636636

637-
if ($second !== null) {
637+
if (isset($variables["second"])) {
638638
$map["second"] = $variables["second"];
639639
}
640640

641-
if ($millisecond !== null) {
641+
if (isset($variables["millisecond"])) {
642642
$map["millisecond"] = $variables["millisecond"];
643643
}
644644

645-
if ($microsecond !== null) {
645+
if (isset($variables["microsecond"])) {
646646
$map["microsecond"] = $variables["microsecond"];
647647
}
648648

649-
if ($nanosecond !== null) {
649+
if (isset($variables["nanosecond"])) {
650650
$map["nanosecond"] = $variables["nanosecond"];
651651
}
652652

@@ -688,35 +688,35 @@ public static function localDatetimeYWD($year, $week = null, $dayOfWeek = null,
688688

689689
$map = ["year" => $year];
690690

691-
if ($week !== null) {
691+
if (isset($variables["week"])) {
692692
$map["week"] = $variables["week"];
693693
}
694694

695-
if ($dayOfWeek !== null) {
695+
if (isset($variables["dayOfWeek"])) {
696696
$map["dayOfWeek"] = $variables["dayOfWeek"];
697697
}
698698

699-
if ($hour !== null) {
699+
if (isset($variables["hour"])) {
700700
$map["hour"] = $variables["hour"];
701701
}
702702

703-
if ($minute !== null) {
703+
if (isset($variables["minute"])) {
704704
$map["minute"] = $variables["minute"];
705705
}
706706

707-
if ($second !== null) {
707+
if (isset($variables["second"])) {
708708
$map["second"] = $variables["second"];
709709
}
710710

711-
if ($millisecond !== null) {
711+
if (isset($variables["millisecond"])) {
712712
$map["millisecond"] = $variables["millisecond"];
713713
}
714714

715-
if ($microsecond !== null) {
715+
if (isset($variables["microsecond"])) {
716716
$map["microsecond"] = $variables["microsecond"];
717717
}
718718

719-
if ($nanosecond !== null) {
719+
if (isset($variables["nanosecond"])) {
720720
$map["nanosecond"] = $variables["nanosecond"];
721721
}
722722

@@ -757,35 +757,35 @@ public static function localDatetimeYQD($year, $quarter = null, $dayOfQuarter =
757757

758758
$map = ["year" => $year];
759759

760-
if ($quarter !== null) {
760+
if (isset($variables["quarter"])) {
761761
$map["quarter"] = $variables["quarter"];
762762
}
763763

764-
if ($dayOfQuarter !== null) {
764+
if (isset($variables["dayOfQuarter"])) {
765765
$map["dayOfQuarter"] = $variables["dayOfQuarter"];
766766
}
767767

768-
if ($hour !== null) {
768+
if (isset($variables["hour"])) {
769769
$map["hour"] = $variables["hour"];
770770
}
771771

772-
if ($minute !== null) {
772+
if (isset($variables["minute"])) {
773773
$map["minute"] = $variables["minute"];
774774
}
775775

776-
if ($second !== null) {
776+
if (isset($variables["second"])) {
777777
$map["second"] = $variables["second"];
778778
}
779779

780-
if ($millisecond !== null) {
780+
if (isset($variables["millisecond"])) {
781781
$map["millisecond"] = $variables["millisecond"];
782782
}
783783

784-
if ($microsecond !== null) {
784+
if (isset($variables["microsecond"])) {
785785
$map["microsecond"] = $variables["microsecond"];
786786
}
787787

788-
if ($nanosecond !== null) {
788+
if (isset($variables["nanosecond"])) {
789789
$map["nanosecond"] = $variables["nanosecond"];
790790
}
791791

@@ -824,31 +824,31 @@ public static function localDatetimeYD($year, $ordinalDay = null, $hour = null,
824824

825825
$map = ["year" => $year];
826826

827-
if ($ordinalDay !== null) {
827+
if (isset($variables["ordinalDay"])) {
828828
$map["ordinalDay"] = $variables["ordinalDay"];
829829
}
830830

831-
if ($hour !== null) {
831+
if (isset($variables["hour"])) {
832832
$map["hour"] = $variables["hour"];
833833
}
834834

835-
if ($minute !== null) {
835+
if (isset($variables["minute"])) {
836836
$map["minute"] = $variables["minute"];
837837
}
838838

839-
if ($second !== null) {
839+
if (isset($variables["second"])) {
840840
$map["second"] = $variables["second"];
841841
}
842842

843-
if ($millisecond !== null) {
843+
if (isset($variables["millisecond"])) {
844844
$map["millisecond"] = $variables["millisecond"];
845845
}
846846

847-
if ($microsecond !== null) {
847+
if (isset($variables["microsecond"])) {
848848
$map["microsecond"] = $variables["microsecond"];
849849
}
850850

851-
if ($nanosecond !== null) {
851+
if (isset($variables["nanosecond"])) {
852852
$map["nanosecond"] = $variables["nanosecond"];
853853
}
854854

@@ -918,23 +918,23 @@ public static function localTime($hour, $minute = null, $second = null, $millise
918918

919919
$map = ["hour" => $hour];
920920

921-
if ($minute !== null) {
921+
if (isset($variables["minute"])) {
922922
$map["minute"] = $variables["minute"];
923923
}
924924

925-
if ($second !== null) {
925+
if (isset($variables["second"])) {
926926
$map["second"] = $variables["second"];
927927
}
928928

929-
if ($millisecond !== null) {
929+
if (isset($variables["millisecond"])) {
930930
$map["millisecond"] = $variables["millisecond"];
931931
}
932932

933-
if ($microsecond !== null) {
933+
if (isset($variables["microsecond"])) {
934934
$map["microsecond"] = $variables["microsecond"];
935935
}
936936

937-
if ($nanosecond !== null) {
937+
if (isset($variables["nanosecond"])) {
938938
$map["nanosecond"] = $variables["nanosecond"];
939939
}
940940

@@ -1004,23 +1004,23 @@ public static function timeHMS($hour, $minute = null, $second = null, $milliseco
10041004

10051005
$map = ["hour" => $hour];
10061006

1007-
if ($minute !== null) {
1007+
if (isset($variables["minute"])) {
10081008
$map["minute"] = $variables["minute"];
10091009
}
10101010

1011-
if ($second !== null) {
1011+
if (isset($variables["second"])) {
10121012
$map["second"] = $variables["second"];
10131013
}
10141014

1015-
if ($millisecond !== null) {
1015+
if (isset($variables["millisecond"])) {
10161016
$map["millisecond"] = $variables["millisecond"];
10171017
}
10181018

1019-
if ($microsecond !== null) {
1019+
if (isset($variables["microsecond"])) {
10201020
$map["microsecond"] = $variables["microsecond"];
10211021
}
10221022

1023-
if ($nanosecond !== null) {
1023+
if (isset($variables["nanosecond"])) {
10241024
$map["nanosecond"] = $variables["nanosecond"];
10251025
}
10261026

0 commit comments

Comments
 (0)