protected function buildDistanceMatrixResponseElement($element)
    {
        $status = $element->status;
        $distance = null;
        $duration = null;

        if ($element->status === DistanceMatrixElementStatus::OK) {
            $distance = new Distance($element->distance->text, $element->distance->value);
            $duration = new Duration($element->duration->text, $element->duration->value);
        }

        return new DistanceMatrixResponseElement($status, $distance, $duration);
    }