original_string: public function setValue($value)
      {
          if (empty($value)) {
              $value = array();
          } elseif (is_scalar($value)) {
              if (!is_numeric($value)) {
                  $value = strtotime($value);
              }
              // might be a unix epoch, then we fill all possible values
              $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
              $value = array(
                  'D' => $arr[0],
                  'l' => $arr[0],
                  'd' => $arr[1],
                  'M' => $arr[2],
                  'm' => $arr[2],
                  'F' => $arr[2],
                  'Y' => $arr[3],
                  'y' => $arr[3],
                  'h' => $arr[4],
                  'g' => $arr[4],
                  'H' => $arr[5],
                  'i' => $this->trimLeadingZeros($arr[6]),
                  's' => $this->trimLeadingZeros($arr[7]),
                  'a' => $arr[8],
                  'A' => $arr[9],
                  'W' => $this->trimLeadingZeros($arr[10])
              );
          } else {
              $value = array_map(array($this, 'trimLeadingZeros'), $value);
          }
          return parent::setValue($value);
      }
code: public function setValue($value)
      {
          if (empty($value)) {
              $value = array();
          } elseif (is_scalar($value)) {
              if (!is_numeric($value)) {
                  $value = strtotime($value);
              }
              // might be a unix epoch, then we fill all possible values
              $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
              $value = array(
                  'D' => $arr[0],
                  'l' => $arr[0],
                  'd' => $arr[1],
                  'M' => $arr[2],
                  'm' => $arr[2],
                  'F' => $arr[2],
                  'Y' => $arr[3],
                  'y' => $arr[3],
                  'h' => $arr[4],
                  'g' => $arr[4],
                  'H' => $arr[5],
                  'i' => $this->trimLeadingZeros($arr[6]),
                  's' => $this->trimLeadingZeros($arr[7]),
                  'a' => $arr[8],
                  'A' => $arr[9],
                  'W' => $this->trimLeadingZeros($arr[10])
              );
          } else {
              $value = array_map(array($this, 'trimLeadingZeros'), $value);
          }
          return parent::setValue($value);
      }
code_tokens: public function setValue ( $ value ) { if ( empty ( $ value ) ) { $ value = array ( ) ; } elseif ( is_scalar ( $ value ) ) { if ( ! is_numeric ( $ value ) ) { $ value = strtotime ( $ value ) ; } // might be a unix epoch, then we fill all possible values $ arr = explode ( '-' , date ( 'w-j-n-Y-g-G-i-s-a-A-W' , ( int ) $ value ) ) ; $ value = array ( 'D' => $ arr [ 0 ] , 'l' => $ arr [ 0 ] , 'd' => $ arr [ 1 ] , 'M' => $ arr [ 2 ] , 'm' => $ arr [ 2 ] , 'F' => $ arr [ 2 ] , 'Y' => $ arr [ 3 ] , 'y' => $ arr [ 3 ] , 'h' => $ arr [ 4 ] , 'g' => $ arr [ 4 ] , 'H' => $ arr [ 5 ] , 'i' => $ this -> trimLeadingZeros ( $ arr [ 6 ] ) , 's' => $ this -> trimLeadingZeros ( $ arr [ 7 ] ) , 'a' => $ arr [ 8 ] , 'A' => $ arr [ 9 ] , 'W' => $ this -> trimLeadingZeros ( $ arr [ 10 ] ) ) ; } else { $ value = array_map ( array ( $ this , 'trimLeadingZeros' ) , $ value ) ; } return parent :: setValue ( $ value ) ; }
docstring: Tries to convert the given value to a usable date before setting the
  element value
  @param    int|string|array    A timestamp, a string compatible with strtotime()
  or an array that fits the element names
docstring_tokens: Tries to convert the given value to a usable date before setting the element value