Example #1
0
 /**
  * Reset the job in preparation for starting over.
  *
  * @return void
  */
 public static function reset()
 {
     static::$output = "";
     static::$start = "";
     static::$end = "";
     static::$stopped = true;
 }
 /**
  * Set the internal iterator with interval for the instance.
  *
  * @param \DateInterval $interval
  * @param \Closure $callback
  * @return CarbonDate|$this
  */
 public function each(\DateInterval $interval, \Closure $callback)
 {
     $period = new static($this->start(), $this->start()->add($interval));
     do {
         $callback(new static($period->start(), $period->end() > $this->endDate ? $this->endDate : $period->end()));
     } while ($period->add($interval)->start() < $this->endDate);
     return $this;
 }
Example #3
0
 public function end($value)
 {
     static::$end = Carbon::parse($value, static::$tz)->hour(0)->minute(0)->second(0);
     return $this;
 }