@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | */ |
30 | 30 | private function getEaster ($pYear = null) |
31 | 31 | { |
32 | - if (is_null ($pYear)) { |
|
32 | + if (is_null ($pYear)) { |
|
33 | 33 | $pYear = (int)date ('Y'); |
34 | - } |
|
35 | - $nDate = $pYear - 1900; |
|
36 | - $pAa = $nDate%19; |
|
37 | - $pBb = floor (((7*$pAa)+1)/19); |
|
38 | - $pCc = ((11*$pAa)-$pBb+4)%29; |
|
39 | - $pDd = floor ($nDate/4); |
|
40 | - $pEe = ($nDate-$pCc+$pDd+31)%7; |
|
41 | - $pResult = 25-$pCc-$pEe; |
|
42 | - if ($pResult > 0) { |
|
34 | + } |
|
35 | + $nDate = $pYear - 1900; |
|
36 | + $pAa = $nDate%19; |
|
37 | + $pBb = floor (((7*$pAa)+1)/19); |
|
38 | + $pCc = ((11*$pAa)-$pBb+4)%29; |
|
39 | + $pDd = floor ($nDate/4); |
|
40 | + $pEe = ($nDate-$pCc+$pDd+31)%7; |
|
41 | + $pResult = 25-$pCc-$pEe; |
|
42 | + if ($pResult > 0) { |
|
43 | 43 | $pEaster = strtotime ($pYear.'/04/'.$pResult); |
44 | - } else { |
|
44 | + } else { |
|
45 | 45 | $pEaster = strtotime ($pYear.'/03/'.(31+$pResult)); |
46 | - } |
|
47 | - return $pEaster; |
|
46 | + } |
|
47 | + return $pEaster; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -58,25 +58,25 @@ discard block |
||
58 | 58 | * @return integer Delta next business day |
59 | 59 | */ |
60 | 60 | function getNextOpenDay ($pDate, $pDays) { |
61 | - $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
|
62 | - if (function_exists ('easter_date')) { |
|
61 | + $aBankHolidays = ['1_1', '1_5', '8_5', '14_7', '15_8', '1_11', '11_11', '25_12', ]; |
|
62 | + if (function_exists ('easter_date')) { |
|
63 | 63 | $pEaster = easter_date ((int)date('Y'), $pDate); |
64 | - } else { |
|
64 | + } else { |
|
65 | 65 | $pEaster = $this->getEaster ((int)date('Y'), $pDate); |
66 | - } |
|
67 | - $aBankHolidays[] = date ('j_n',$pEaster); |
|
68 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
69 | - $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
66 | + } |
|
67 | + $aBankHolidays[] = date ('j_n',$pEaster); |
|
68 | + $aBankHolidays[] = date ('j_n', $pEaster + (86400*39)); |
|
69 | + $aBankHolidays[] = date ('j_n', $pEaster + (86400*49)); |
|
70 | 70 | |
71 | 71 | $pEnd = $pDays * 86400; |
72 | - $idn = 0; |
|
73 | - while ($idn < $pEnd) { |
|
74 | - $idn = strtotime ('+1 day', $idn); |
|
75 | - if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
76 | - $pEnd = strtotime ('+1 day', $pEnd); |
|
77 | - $pDays ++; |
|
78 | - } |
|
79 | - } |
|
80 | - return $pDays; |
|
72 | + $idn = 0; |
|
73 | + while ($idn < $pEnd) { |
|
74 | + $idn = strtotime ('+1 day', $idn); |
|
75 | + if (in_array (date ('w', $pDate+$idn),array (0,6) ) || in_array (date ('j_n', $pDate+$idn), $aBankHolidays)) { |
|
76 | + $pEnd = strtotime ('+1 day', $pEnd); |
|
77 | + $pDays ++; |
|
78 | + } |
|
79 | + } |
|
80 | + return $pDays; |
|
81 | 81 | } |
82 | 82 | } |