本文整理汇总了PHP中Valid::byFreqValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Valid::byFreqValid方法的具体用法?PHP Valid::byFreqValid怎么用?PHP Valid::byFreqValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Valid
的用法示例。
在下文中一共展示了Valid::byFreqValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareDateElements
protected function prepareDateElements()
{
// if the interval isn't set, set it.
if (!isset($this->interval)) {
$this->interval = 1;
}
// must have a frequency
if (!isset($this->freq) && Valid::byFreqValid($this->freq, $this->byweeknos, $this->byyeardays, $this->bymonthdays)) {
throw new FrequencyRequired();
}
if (!isset($this->count)) {
$this->count = 200;
}
// "Similarly, if the BYMINUTE, BYHOUR, BYDAY,
// BYMONTHDAY, or BYMONTH rule part were missing, the appropriate
// minute, hour, day, or month would have been retrieved from the
// "DTSTART" property."
// if there is no startDate, make it now
if (!$this->startDate) {
$this->startDate = new \DateTime();
}
// the calendar repeats itself every 400 years, so if a date
// doesn't exist for 400 years, I don't think it will ever
// occur
if (!isset($this->until)) {
$this->until = new \DateTime();
$this->until->add(new \DateInterval('P400Y'));
}
if (!isset($this->byminutes)) {
$this->byminutes = array((int) $this->startDate->format('i'));
}
if (!isset($this->byhours)) {
$this->byhours = array((int) $this->startDate->format('G'));
}
if (!isset($this->byseconds)) {
$this->byseconds = array((int) $this->startDate->format('s'));
}
if (!isset($this->wkst)) {
$this->wkst = "mo";
}
/*if (!isset($this->bydays))
{
$dayOfWeek = $this->startDate->format('l');
$dayOfWeekAbr = strtolower(substr($dayOfWeek, 0, 2));
$this->bydays = array($dayOfWeekAbr);
}*/
if ($this->freq === "monthly") {
if (!isset($this->bymonthdays) && !isset($this->bydays)) {
$this->bymonthdays = array((int) $this->startDate->format('j'));
}
}
if ($this->freq === "weekly") {
if (!isset($this->bymonthdays) && !isset($this->bydays)) {
$dayOfWeek = $this->startDate->format('l');
$dayOfWeekAbr = strtolower(substr($dayOfWeek, 0, 2));
$this->bydays = array("0" . $dayOfWeekAbr);
}
}
if ($this->freq === "yearly") {
if (!isset($this->bydays) && !isset($this->bymonths) && !isset($this->bymonthdays) && !isset($this->byyeardays) && !isset($this->byweeknos) && !isset($this->bysetpos)) {
$this->bymonth($this->startDate->format('n'));
}
}
}