public function isValid()
    {
        $isValid = $this->hasDestination() && $this->hasOrigin();

        for ($i = 0; $isValid && ($i < count($this->waypoints)); $i++) {
            $isValid = $this->waypoints[$i]->isValid();
        }

        if ($this->getTravelMode() === TravelMode::TRANSIT) {
            $isValid = $this->hasArrivalTime() || $this->hasDepartureTime();
        }

        return $isValid;
    }
public function isValid()
    {
        $isValid = $this->hasDestination() && $this->hasOrigin();

        for ($i = 0; $isValid && ($i < count($this->waypoints)); $i++) {
            $isValid = $this->waypoints[$i]->isValid();
        }

        if ($this->getTravelMode() === TravelMode::TRANSIT) {
            $isValid = $this->hasArrivalTime() || $this->hasDepartureTime();
        }

        return $isValid;
    }
public function isValid ( ) { $ isValid = $ this -> hasDestination ( ) && $ this -> hasOrigin ( ) ; for ( $ i = 0 ; $ isValid && ( $ i < count ( $ this -> waypoints ) ) ; $ i ++ ) { $ isValid = $ this -> waypoints [ $ i ] -> isValid ( ) ; } if ( $ this -> getTravelMode ( ) === TravelMode :: TRANSIT ) { $ isValid = $ this -> hasArrivalTime ( ) || $ this -> hasDepartureTime ( ) ; } return $ isValid ; }
Checks if the directions request is valid.

@return boolean TRUE if the directions request is valid else FALSE.
Checks if the directions request is valid .