Ejemplo n.º 1
0
 /**
  * From string
  * @param string $string
  */
 public function fromString($string)
 {
     if (substr($string, 0, 1) == self::RESTING) {
         $this->Active = false;
         $string = substr($string, 1);
     }
     $Duration = new Duration(substr(strrchr($string, self::SEPARATOR), 1));
     $this->Distance = rstrstr($string, self::SEPARATOR);
     $this->Time = $Duration->seconds();
 }
Ejemplo n.º 2
0
 /**
  * Transform splits from internal string to array 
  */
 private function stringToArray()
 {
     $this->asArray = array();
     $splits = explode('-', str_replace('\\r\\n', '-', $this->asString));
     foreach ($splits as $split) {
         if (substr($split, 0, 1) == 'R') {
             $active = false;
             $split = substr($split, 1);
         } else {
             $active = true;
         }
         if (strlen($split) > 3) {
             $this->asArray[] = array('km' => rstrstr($split, '|'), 'time' => substr(strrchr($split, '|'), 1), 'active' => $active);
         }
     }
 }