當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Valid::byFreqValid方法代碼示例

本文整理匯總了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'));
         }
     }
 }
開發者ID:solleer,項目名稱:framework,代碼行數:64,代碼來源:When.php


注:本文中的Valid::byFreqValid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。