Skip to content

Commit

Permalink
Improve variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
u01jmg3 committed Mar 6, 2019
1 parent 4795fd3 commit cd812ff
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ICal/ICal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2369,14 +2369,13 @@ protected function parseDuration($date, $duration, $format = self::UNIX_FORMAT)
*/
protected function numberOfDays($days, $start, $end)
{
$w = array(date('w', $start), date('w', $end));
$oneWeek = self::SECONDS_IN_A_WEEK;
$x = floor(($end - $start) / $oneWeek);
$sum = 0;
$w = array(date('w', $start), date('w', $end));
$base = floor(($end - $start) / self::SECONDS_IN_A_WEEK);
$sum = 0;

for ($day = 0; $day < 7; ++$day) {
if ($days & pow(2, $day)) {
$sum += $x + (($w[0] > $w[1]) ? $w[0] <= $day || $day <= $w[1] : $w[0] <= $day && $day <= $w[1]);
$sum += $base + (($w[0] > $w[1]) ? $w[0] <= $day || $day <= $w[1] : $w[0] <= $day && $day <= $w[1]);
}
}

Expand Down

0 comments on commit cd812ff

Please sign in to comment.