Пример #1
0
 /**
  * @param \DateTime $begin
  * @param int       $firstWeekday
  */
 public function __construct(\DateTime $begin, $firstWeekday = Day::MONDAY)
 {
     $this->begin = clone $begin;
     $this->end = clone $begin;
     $this->end->add(new \DateInterval('P1D'));
     parent::__construct($firstWeekday);
 }
Пример #2
0
 /**
  * @param \DateTime        $start
  * @param FactoryInterface $factory
  *
  * @throws Exception\NotAWeek
  */
 public function __construct(\DateTime $start, $factory = null)
 {
     if (!self::isValid($start)) {
         throw new Exception\NotAWeek();
     }
     $this->begin = clone $start;
     $this->end = clone $start;
     $this->end->add($this->getDateInterval());
     parent::__construct($factory);
 }
Пример #3
0
 /**
  * @param \DateTime $start
  * @param int       $firstWeekday
  *
  * @throws Exception\NotAWeek
  */
 public function __construct(\DateTime $start, $firstWeekday = Day::MONDAY)
 {
     if (!self::isValid($start)) {
         throw new Exception\NotAWeek();
     }
     $this->begin = clone $start;
     $this->end = clone $start;
     $this->end->add(new \DateInterval('P7D'));
     parent::__construct($firstWeekday);
 }
Пример #4
0
 /**
  * @param \DateTime        $begin
  * @param FactoryInterface $factory
  *
  * @throws Exception\NotAMinute
  */
 public function __construct(\DateTime $begin, $factory = null)
 {
     parent::__construct($factory);
     if ($this->getFactory()->getStrictDates() && !self::isValid($begin)) {
         throw new Exception\NotAMinute();
     }
     // Not in strict mode, accept any timestamp and set the begin date back to the beginning of this period.
     $this->begin = clone $begin;
     $this->begin->setTime($this->begin->format('G'), $this->begin->format('i'), 0);
     $this->end = clone $begin;
     $this->end->add($this->getDateInterval());
 }
Пример #5
0
 /**
  * @param \DateTime        $begin
  * @param \DateTime        $end
  * @param FactoryInterface $factory
  */
 public function __construct(\DateTime $begin, \DateTime $end, $factory = null)
 {
     $this->begin = clone $begin;
     $this->end = clone $end;
     parent::__construct($factory);
 }
Пример #6
0
 /**
  * @param \DateTime $begin
  * @param \DateTime $end
  * @param int       $firstWeekday
  */
 public function __construct(\DateTime $begin, \DateTime $end, $firstWeekday = Day::MONDAY)
 {
     $this->begin = clone $begin;
     $this->end = clone $end;
     parent::__construct($firstWeekday);
 }