Example #1
0
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     $dtime = \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value);
     if (!$dtime) {
         throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeFormatString());
     }
     return TimePointFactory::fromDateTime($dtime);
 }
Example #2
0
 /**
  * @param string                 $title
  * @param array                  $events
  * @param StrategyInterface|null $strategy
  */
 public function __construct($title, array $events = array(), StrategyInterface $strategy = null)
 {
     $this->strategy = null === $strategy ? new BaseStrategy() : $strategy;
     $this->title = $title;
     $this->events = array();
     $this->calendars = array();
     foreach ($events as $event) {
         $this->add($event);
     }
     $this->cursor = 0 === count($this->events) ? TimePointFactory::now() : $this->events[0]->getInterval()->getBegin();
     //$this->cursor = null;
 }