コード例 #1
0
 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     $this->addOption('input_timezone', 'UTC');
     $this->addOption('output_timezone', 'UTC');
     $this->addOption('pad', false);
     $this->addOption('fields', array('year', 'month', 'day', 'hour', 'minute', 'second'));
     parent::configure();
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     $this->addOption('date_format', self::MEDIUM);
     $this->addOption('time_format', self::SHORT);
     $this->addOption('input_timezone', 'UTC');
     $this->addOption('output_timezone', 'UTC');
     if (!in_array($this->getOption('date_format'), self::$formats, true)) {
         throw new \InvalidArgumentException(sprintf('The option "date_format" is expected to be one of "%s". Is "%s"', implode('", "', self::$formats), $this->getOption('time_format')));
     }
     if (!in_array($this->getOption('time_format'), self::$formats, true)) {
         throw new \InvalidArgumentException(sprintf('The option "time_format" is expected to be one of "%s". Is "%s"', implode('", "', self::$formats), $this->getOption('time_format')));
     }
     parent::configure();
 }