예제 #1
0
파일: integer.php 프로젝트: Webthink/sprig
 public function value($value)
 {
     $value = parent::value($value);
     if ($value !== NULL) {
         $value = (int) $value;
     }
     return $value;
 }
예제 #2
0
파일: float.php 프로젝트: vitch/sprig
 public function set($value)
 {
     if (is_int($this->places)) {
         $value = number_format($value, $this->places);
     } else {
         $value = (double) $value;
     }
     return parent::set($value);
 }
예제 #3
0
 public function value($value)
 {
     $value = parent::value($value);
     if ($value === '' or $value === NULL) {
         // Empty strings are not a valid timestamp
         $value = NULL;
     } else {
         $value = (int) $value;
     }
     return $value;
 }
예제 #4
0
 /**
  * Returns the fields’ value in local timezone
  * 
  * @param value
  * @return time
  */
 public function value($value)
 {
     $format = 'Y-m-d H:i:s';
     $value = parent::value($value);
     if (is_null($value)) {
         return gmdate($format);
     } elseif (is_int($value)) {
         return gmdate($format, $value);
     } else {
         return date($format, strtotime($value . ' +0000'));
     }
 }
예제 #5
0
파일: boolean.php 프로젝트: vitch/sprig
 public function set($value)
 {
     return parent::set((bool) $value);
 }
예제 #6
0
파일: char.php 프로젝트: vitch/sprig
 public function set($value)
 {
     return parent::set((string) $value);
 }
예제 #7
0
파일: manytomany.php 프로젝트: ascseb/sprig
 public function set($value)
 {
     return parent::set((array) $value);
 }