@param int $days

@return Period
436941
public function withDays(int $days) : Period
    {
        if ($days === $this->days) {
            return $this;
        }

        return new Period($this->years, $this->months, $days);
    }
1321532
public function getPeriods2()
  {
    $periods = array();

    $this->Period->byOrganizationWithYear($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($Period) use (&$periods)
    {
      // array_push($periods, array('value'=> $Period->id, 'label' => $this->Lang->get('decima-accounting::period-management.' . $Period->month) . ' ' . $Period->year->year));
      array_push($periods, array('value'=> $Period->id, 'label' => $this->Lang->get('decima-accounting::period-management.' . $Period->month) . ' ' . $Period->year));
    });

    return $periods;
  }
141066
public function subtractDays($days)
    {
        $days = (int) $days;
        $days = -$days;
        return $this->addDays($days);
    }
196842
public final function setDay( int $day = null )
      : DateTime
   {

      if ( \is_null( $day ) )
      {
         $day = static::CurrentDay();
      }

      return $this->setDateParts( null, null, $day );

   }
487126
public function plusMonths(int $months) : Period
    {
        if ($months === 0) {
            return $this;
        }

        return new Period($this->years, $this->months + $months, $this->days);
    }
674269
public function weeksAndDays($weeks, $days)
    {
        $this->dayz = ($weeks * Date::DAYS_PER_WEEK) + $days;

        return $this;
    }
1330580
public function withDay(int $day) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->withDay($day), $this->timeZone);
    }
538562
public function plusDays(int $days) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->plusDays($days), $this->timeZone);
    }
1003846
public function withYears(int $years) : Period
    {
        if ($years === $this->years) {
            return $this;
        }

        return new Period($years, $this->months, $this->days);
    }
735204
public function addWorkdays($days)
    {
        $done = 0;
        $days = (int) $days;
        $sign = '+';

        if ($days < 0) {
            $days *= -1;
            $sign = '-';
        }

        while ($done < $days) {
            $this->modify("{$sign} 1 day");
            if ($this->isWorkday()) {
                $done++;
            }
        }

        return $this;
    }
1110819
public static function getDays() {
        $days = array();
        for ($i = 1; $i <= 31; $i++) {
            if ($i < 10)
                $days[$i] = '0' . $i;
            else
                $days[$i] = $i;
        }
        return $days;
    }
673081
protected function _getInterval($interval) {
		if ($interval !== null) {
			return $interval;
		} elseif (!empty($this->params['interval'])) {
			return $this->params['interval'];
		} else {
			return '1 day';
		}
	}
731474
public function remove(int $offset): Period
    {
        $interval = $this->get($offset);
        unset($this->intervals[$offset]);

        $this->intervals = array_values($this->intervals);

        return $interval;
    }
921811
public function days($date = null)
	{
		return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
948860
function RemoveDay(Day $day)
    {
        $result = array();
        foreach ($this->days as $currentDay)
        {
            if ($currentDay->DayOfWeek != $day->DayOfWeek())
                $result[] = $currentDay;
        }
        $this->days = $result;
    }
851598
public function setDay($day)
    {
        if(! in_array($day, $this->weekDays)) {
            throw new InvalidArgumentException('Argument is not a day of the week');
        }
        $this->day = $day;
        return $this;
    }
569871
public static Date calculatePastDate(int days) {
        final Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DATE, -days);

        return cal.getTime();
    }