egeloen / ivory-google-map

Google Map API v3 integration for PHP 5.6+.
MIT License
325 stars 185 forks source link

Origin and Destinations are switched in response of DistanceMatrix API. #82

Closed sajin577 closed 10 years ago

sajin577 commented 10 years ago

Response is displaying origin as destination and destination as origin.

File: ivory-google-map-master/src/Ivory/GoogleMap/Services/DistanceMatrix/DistanceMatrix.php

protected function buildDistanceMatrixResponse(\stdClass $distanceMatrixResponse)
{
    $status = $distanceMatrixResponse->status;
    $destinations = $distanceMatrixResponse->destination_addresses;
    $origins = $distanceMatrixResponse->origin_addresses;
    $rows = $this->buildDistanceMatrixRows($distanceMatrixResponse->rows);

    return new DistanceMatrixResponse($status,$destinations,$origin,$rows);
}

Order of the return parameter is wrong when passing to DistanceMatrixResponse..

egeloen commented 10 years ago

Thx for reporting the issue! Can you provide a PR?

egeloen commented 10 years ago

This has been fixed in 882cb65