public function getEnd()
    {
        // if end property is defined, use it
        if ($this->end) {
            return clone $this->end;
        }

        $numberOfPosts = count($this->getPoints());

        // try to find last time of point and use it as end date
        if ($this->haveGPSData()) {
            return $this->getPoints()[$numberOfPosts - 1]->getTime();
        }

        // if there are no points, calculate end date from duration
        return $this->getStart()->add(new \DateInterval('PT' . $this->getDuration() . 'S'));
    }
public function getEnd()
    {
        // if end property is defined, use it
        if ($this->end) {
            return clone $this->end;
        }

        $numberOfPosts = count($this->getPoints());

        // try to find last time of point and use it as end date
        if ($this->haveGPSData()) {
            return $this->getPoints()[$numberOfPosts - 1]->getTime();
        }

        // if there are no points, calculate end date from duration
        return $this->getStart()->add(new \DateInterval('PT' . $this->getDuration() . 'S'));
    }
public function getEnd ( ) { // if end property is defined, use it if ( $ this -> end ) { return clone $ this -> end ; } $ numberOfPosts = count ( $ this -> getPoints ( ) ) ; // try to find last time of point and use it as end date if ( $ this -> haveGPSData ( ) ) { return $ this -> getPoints ( ) [ $ numberOfPosts - 1 ] -> getTime ( ) ; } // if there are no points, calculate end date from duration return $ this -> getStart ( ) -> add ( new \ DateInterval ( 'PT' . $ this -> getDuration ( ) . 'S' ) ) ; }
Get time of end of workout. It can be manual set or it is counted based on start and duration.

@return \DateTime
Get time of end of workout . It can be manual set or it is counted based on start and duration .