Passed
Branch main (53b992)
by Sammy
11:16 queued 04:32
created
DatoTempo.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
   const FORMAT = 'Y-m-d H:i:s';
8 8
 
9
-  public static function format($parm=null, $format=null)
9
+  public static function format($parm = null, $format = null)
10 10
   {
11 11
     return parent::format($parm, $format ?? self::FORMAT);
12 12
   }
Please login to merge, or discard this patch.
Dato.class.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
     return parent::format(null, $format);
25 25
   }
26 26
 
27
-	// find the total numbers of days in full years since the mythical 1/1/0001, then add the number of days before the current one in the year passed. Do this for each date, then return the absolute value of the difference
28
-	public static function days_diff($a, $b, $c = 'DateTime')
29
-	{
30
-		return (is_a($a,$c) && is_a($b,$c)) ? self::days($a) - self::days($b) : false;
31
-	}
32
-
33
-	public static function days($x, $d = 0)
34
-	{
27
+  // find the total numbers of days in full years since the mythical 1/1/0001, then add the number of days before the current one in the year passed. Do this for each date, then return the absolute value of the difference
28
+  public static function days_diff($a, $b, $c = 'DateTime')
29
+  {
30
+    return (is_a($a,$c) && is_a($b,$c)) ? self::days($a) - self::days($b) : false;
31
+  }
32
+
33
+  public static function days($x, $d = 0)
34
+  {
35 35
     $lfy = $x->format('Y') - 1; // last full year
36 36
 
37
-		foreach([4, -100, 400] as $f) // leap year factors
38
-			$d += ($lfy / $f);
37
+    foreach([4, -100, 400] as $f) // leap year factors
38
+      $d += ($lfy / $f);
39 39
 
40
-		return (int)(($lfy * 365.25) + $d + $x->format('z')); // days since 1.1.1001 from last year (+|-) leap days + days in current year
41
-	}
40
+    return (int)(($lfy * 365.25) + $d + $x->format('z')); // days since 1.1.1001 from last year (+|-) leap days + days in current year
41
+  }
42 42
 
43 43
   public static function days_diff_in_parts($amount_of_days)
44
-	{
44
+  {
45 45
     $date_diff = [];
46 46
 
47 47
     $previous_part = 'd';
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
     return $date_diff;
66
-	}
66
+  }
67 67
 
68 68
   public static function first_date($year, $month, $format=null)
69 69
   {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
   const MONTHES_IN_A_YEAR = 12;
13 13
 
14 14
 
15
-  public static function format($parm=null, $format=null)
15
+  public static function format($parm = null, $format = null)
16 16
   {
17 17
     $format = $format ?? self::FORMAT;
18 18
     return parent::format($parm, $format);
19 19
   }
20 20
 
21
-  public static function today($format=null)
21
+  public static function today($format = null)
22 22
   {
23 23
     $format = $format ?? self::FORMAT;
24 24
     return parent::format(null, $format);
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 	// find the total numbers of days in full years since the mythical 1/1/0001, then add the number of days before the current one in the year passed. Do this for each date, then return the absolute value of the difference
28 28
 	public static function days_diff($a, $b, $c = 'DateTime')
29 29
 	{
30
-		return (is_a($a,$c) && is_a($b,$c)) ? self::days($a) - self::days($b) : false;
30
+		return (is_a($a, $c) && is_a($b, $c)) ? self::days($a) - self::days($b) : false;
31 31
 	}
32 32
 
33 33
 	public static function days($x, $d = 0)
34 34
 	{
35 35
     $lfy = $x->format('Y') - 1; // last full year
36 36
 
37
-		foreach([4, -100, 400] as $f) // leap year factors
37
+		foreach ([4, -100, 400] as $f) // leap year factors
38 38
 			$d += ($lfy / $f);
39 39
 
40 40
 		return (int)(($lfy * 365.25) + $d + $x->format('z')); // days since 1.1.1001 from last year (+|-) leap days + days in current year
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
     $previous_part = 'd';
48 48
 
49
-    foreach(['w' => self::DAYS_IN_A_WEEK, 'm' => self::WEEKS_IN_A_MONTH, 'y' => self::MONTHES_IN_A_YEAR] as $part => $limit)
49
+    foreach (['w' => self::DAYS_IN_A_WEEK, 'm' => self::WEEKS_IN_A_MONTH, 'y' => self::MONTHES_IN_A_YEAR] as $part => $limit)
50 50
     {
51
-      if($amount_of_days >= $limit)
51
+      if ($amount_of_days >= $limit)
52 52
       {
53 53
         $date_diff[$part] = intval($amount_of_days / $limit);
54 54
         $date_diff[$previous_part] = $amount_of_days % $limit;
@@ -65,21 +65,21 @@  discard block
 block discarded – undo
65 65
     return $date_diff;
66 66
 	}
67 67
 
68
-  public static function first_date($year, $month, $format=null)
68
+  public static function first_date($year, $month, $format = null)
69 69
   {
70 70
     $format = $format ?? self::FORMAT;
71 71
     return date_format(new \DateTime("$year-$month-1"), $format);
72 72
   }
73 73
 
74
-  public static function last_date($year,$month, $format=null)
74
+  public static function last_date($year, $month, $format = null)
75 75
   {
76 76
     $format = $format ?? self::FORMAT;
77
-    return date_format(new \DateTime("$year-$month-".self::last_day($year,$month)), $format);
77
+    return date_format(new \DateTime("$year-$month-".self::last_day($year, $month)), $format);
78 78
   }
79 79
 
80 80
   public static function last_day($year, $month)
81 81
   {
82
-    return date_format(new \DateTime("$year-$month-1"),'t');
82
+    return date_format(new \DateTime("$year-$month-1"), 't');
83 83
   }
84 84
 
85 85
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,8 +34,10 @@  discard block
 block discarded – undo
34 34
 	{
35 35
     $lfy = $x->format('Y') - 1; // last full year
36 36
 
37
-		foreach([4, -100, 400] as $f) // leap year factors
37
+		foreach([4, -100, 400] as $f) {
38
+		  // leap year factors
38 39
 			$d += ($lfy / $f);
40
+		}
39 41
 
40 42
 		return (int)(($lfy * 365.25) + $d + $x->format('z')); // days since 1.1.1001 from last year (+|-) leap days + days in current year
41 43
 	}
@@ -54,8 +56,7 @@  discard block
 block discarded – undo
54 56
         $date_diff[$previous_part] = $amount_of_days % $limit;
55 57
         $previous_part = $part;
56 58
         $amount_of_days = intval($amount_of_days / $limit);
57
-      }
58
-      else
59
+      } else
59 60
       {
60 61
         $date_diff[$previous_part] = $amount_of_days;
61 62
         break;
Please login to merge, or discard this patch.
Base.class.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 
5 5
 abstract class Base
6 6
 {
7
-	public static function format($parm='now', $format)
8
-	{
7
+  public static function format($parm='now', $format)
8
+  {
9 9
     try
10
-		{
10
+    {
11 11
       $date = new \DateTimeImmutable("$parm");
12 12
       return $date->format($format);
13 13
     }
14 14
     catch(\Exception $e)
15
-		{
15
+    {
16 16
       return null;
17 17
     }
18 18
   }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 abstract class Base
6 6
 {
7
-	public static function format($parm='now', $format)
7
+	public static function format($parm = 'now', $format)
8 8
 	{
9 9
     try
10 10
 		{
11 11
       $date = new \DateTimeImmutable("$parm");
12 12
       return $date->format($format);
13 13
     }
14
-    catch(\Exception $e)
14
+    catch (\Exception $e)
15 15
 		{
16 16
       return null;
17 17
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
 		{
11 11
       $date = new \DateTimeImmutable("$parm");
12 12
       return $date->format($format);
13
-    }
14
-    catch(\Exception $e)
13
+    } catch(\Exception $e)
15 14
 		{
16 15
       return null;
17 16
     }
Please login to merge, or discard this patch.