src/Services/Directions/Directions.php
protected function buildDirectionsRoute(\stdClass $directionsRoute)
    {
        $bound = new Bound(
            new Coordinate($directionsRoute->bounds->southwest->lat, $directionsRoute->bounds->southwest->lng),
            new Coordinate($directionsRoute->bounds->northeast->lat, $directionsRoute->bounds->northeast->lng)
        );

        // @see https://github.com/egeloen/IvoryGoogleMapBundle/issues/72
        // @codeCoverageIgnoreStart
        if (!isset($directionsRoute->copyrights)) {
            $directionsRoute->copyrights = '';
        }

        if (!isset($directionsRoute->summary)) {
            $directionsRoute->summary = '';
        }
        // @codeCoverageIgnoreEnd

        $summary = $directionsRoute->summary;
        $copyrights = $directionsRoute->copyrights;

        $directionsLegs = $this->buildDirectionsLegs($directionsRoute->legs);
        $overviewPolyline = new EncodedPolyline($directionsRoute->overview_polyline->points);

        // The warnings & waypoint_order properties can not be defined in the xml format.
        if (!isset($directionsRoute->warnings)) {
            $directionsRoute->warnings = array();
        }

        if (!isset($directionsRoute->waypoint_order)) {
            $directionsRoute->waypoint_order = array();
        }

        $warnings = $directionsRoute->warnings;
        $waypointOrder = $directionsRoute->waypoint_order;

        return new DirectionsRoute(
            $bound,
            $copyrights,
            $directionsLegs,
            $overviewPolyline,
            $summary,
            $warnings,
            $waypointOrder
        );
    }
protected function buildDirectionsRoute(\stdClass $directionsRoute)
    {
        $bound = new Bound(
            new Coordinate($directionsRoute->bounds->southwest->lat, $directionsRoute->bounds->southwest->lng),
            new Coordinate($directionsRoute->bounds->northeast->lat, $directionsRoute->bounds->northeast->lng)
        );

        // @see https://github.com/egeloen/IvoryGoogleMapBundle/issues/72
        // @codeCoverageIgnoreStart
        if (!isset($directionsRoute->copyrights)) {
            $directionsRoute->copyrights = '';
        }

        if (!isset($directionsRoute->summary)) {
            $directionsRoute->summary = '';
        }
        // @codeCoverageIgnoreEnd

        $summary = $directionsRoute->summary;
        $copyrights = $directionsRoute->copyrights;

        $directionsLegs = $this->buildDirectionsLegs($directionsRoute->legs);
        $overviewPolyline = new EncodedPolyline($directionsRoute->overview_polyline->points);

        // The warnings & waypoint_order properties can not be defined in the xml format.
        if (!isset($directionsRoute->warnings)) {
            $directionsRoute->warnings = array();
        }

        if (!isset($directionsRoute->waypoint_order)) {
            $directionsRoute->waypoint_order = array();
        }

        $warnings = $directionsRoute->warnings;
        $waypointOrder = $directionsRoute->waypoint_order;

        return new DirectionsRoute(
            $bound,
            $copyrights,
            $directionsLegs,
            $overviewPolyline,
            $summary,
            $warnings,
            $waypointOrder
        );
    }
Builds the directions route according to the normalized directions API route.

@param \stdClass $directionsRoute The normalized directions route.

@return \Ivory\GoogleMap\Services\Directions\DirectionsRoute The builded directions route.