コード例 #1
0
ファイル: DatePicker.php プロジェクト: brosland/framework
 /**
  * @param string|DateTime $value
  * @return self
  */
 public function setDefaultValue($value = NULL)
 {
     if ($value instanceof DateTime) {
         $value = $value->format($this->format);
     }
     return parent::setDefaultValue($value);
 }
コード例 #2
0
ファイル: TagsInput.php プロジェクト: svobodni/web
 /**
  * @param array $value
  * @return TagInput provides fluent interface
  */
 public function setDefaultValue($value)
 {
     if (!is_array($value)) {
         throw new \Nette\InvalidArgumentException("Invalid argument type passed to " . __METHOD__ . ", expected array.");
     }
     parent::setDefaultValue(implode($this->joiner, $value));
     return $this;
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function setDefaultValue($value)
 {
     if (!$value instanceof \DateTime) {
         $type = gettype($value);
         throw new InvalidArgumentException(sprintf("As default value, %s object must be given, '%s' given instead.", \DateTime::class, $type === 'object' ? get_class($value) : $type));
     }
     return parent::setDefaultValue($value);
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 public function setDefaultValue($value)
 {
     if (!$value instanceof \DateTime) {
         $type = gettype($value);
         throw new InvalidArgumentException("As default value, \\DateTime object must be given. '" . ($type === 'object' ? get_class($value) : $type) . "' given instead");
     }
     return parent::setDefaultValue($value);
 }