Exemplo n.º 1
0
 /**
  * @param string $key
  * @param string $value
  */
 protected function setFromGPX($key, $value)
 {
     if ($value == '' || $value == 0) {
         return;
     }
     if (in_array($key, self::$KEYS_TO_CHECK) && $this->ArraySize > 0) {
         $array = explode(DataObject::$ARR_SEP, $value);
         $length = count($array);
         if ($length > $this->ArraySize) {
             $value = implode(DataObject::$ARR_SEP, array_slice($array, 0, $this->ArraySize));
         } elseif ($length < $this->ArraySize) {
             for ($i = 0; $i < $this->ArraySize - $length; $i++) {
                 $array[] = end($array);
             }
             $value = implode(DataObject::$ARR_SEP, $array);
         }
     }
     $this->TrainingObject->set($key, $value);
 }