# Google Maps Route Optimization V1 Client - Class DurationLimit (0.6.2)

0.6.2 (latest) 0.6.1 0.5.1 0.4.1 0.3.3 0.2.0 0.1.0 Reference documentation and code samples for the Google Maps Route Optimization V1 Client class DurationLimit.

A limit defining a maximum duration of the route of a vehicle. It can be
either hard or soft.

When a soft limit field is defined, both the soft max threshold and its
associated cost must be defined together.

Generated from protobuf message `google.maps.routeoptimization.v1.Vehicle.DurationLimit`

## Namespace

Google \\ Maps \\ RouteOptimization \\ V1 \\ Vehicle

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ max_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` A hard limit constraining the duration to be at most max_duration. |
| `↳ soft_max_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit. If defined, `soft_max_duration` must be nonnegative. If max_duration is also defined, `soft_max_duration` must be less than max_duration. |
| `↳ cost_per_hour_after_soft_max` | `float` Cost per hour incurred if the `soft_max_duration` threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows: `cost_per_hour_after_soft_max * (duration - soft_max_duration)` The cost must be nonnegative. |
| `↳ quadratic_soft_max_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit. If defined, `quadratic_soft_max_duration` must be nonnegative. If `max_duration` is also defined, `quadratic_soft_max_duration` must be less than `max_duration`, and the difference must be no larger than one day: `max_duration - quadratic_soft_max_duration <= 86400 seconds` |
| `↳ cost_per_square_hour_after_quadratic_soft_max` | `float` Cost per square hour incurred if the `quadratic_soft_max_duration` threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows: `cost_per_square_hour_after_quadratic_soft_max * (duration - quadratic_soft_max_duration)^2` The cost must be nonnegative. |

### getMaxDuration

A hard limit constraining the duration to be at most max_duration.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasMaxDuration

### clearMaxDuration

### setMaxDuration

A hard limit constraining the duration to be at most max_duration.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSoftMaxDuration

A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost. This cost adds up to other costs defined in
the model, with the same unit.

If defined, `soft_max_duration` must be nonnegative. If max_duration is
also defined, `soft_max_duration` must be less than max_duration.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasSoftMaxDuration

### clearSoftMaxDuration

### setSoftMaxDuration

A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost. This cost adds up to other costs defined in
the model, with the same unit.

If defined, `soft_max_duration` must be nonnegative. If max_duration is
also defined, `soft_max_duration` must be less than max_duration.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCostPerHourAfterSoftMax

Cost per hour incurred if the `soft_max_duration` threshold is violated.

The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:

      cost_per_hour_after_soft_max * (duration - soft_max_duration)

The cost must be nonnegative.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasCostPerHourAfterSoftMax

### clearCostPerHourAfterSoftMax

### setCostPerHourAfterSoftMax

Cost per hour incurred if the `soft_max_duration` threshold is violated.

The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:

      cost_per_hour_after_soft_max * (duration - soft_max_duration)

The cost must be nonnegative.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getQuadraticSoftMaxDuration

A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost, quadratic in the duration. This cost adds
up to other costs defined in the model, with the same unit.

If defined, `quadratic_soft_max_duration` must be nonnegative. If
`max_duration` is also defined, `quadratic_soft_max_duration` must be
less than `max_duration`, and the difference must be no larger than one
day:
`max_duration - quadratic_soft_max_duration <= 86400 seconds`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasQuadraticSoftMaxDuration

### clearQuadraticSoftMaxDuration

### setQuadraticSoftMaxDuration

A soft limit not enforcing a maximum duration limit, but when violated
makes the route incur a cost, quadratic in the duration. This cost adds
up to other costs defined in the model, with the same unit.

If defined, `quadratic_soft_max_duration` must be nonnegative. If
`max_duration` is also defined, `quadratic_soft_max_duration` must be
less than `max_duration`, and the difference must be no larger than one
day:
`max_duration - quadratic_soft_max_duration <= 86400 seconds`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCostPerSquareHourAfterQuadraticSoftMax

Cost per square hour incurred if the
`quadratic_soft_max_duration` threshold is violated.

The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:

      cost_per_square_hour_after_quadratic_soft_max *
      (duration - quadratic_soft_max_duration)^2

The cost must be nonnegative.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasCostPerSquareHourAfterQuadraticSoftMax

### clearCostPerSquareHourAfterQuadraticSoftMax

### setCostPerSquareHourAfterQuadraticSoftMax

Cost per square hour incurred if the
`quadratic_soft_max_duration` threshold is violated.

The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:

      cost_per_square_hour_after_quadratic_soft_max *
      (duration - quadratic_soft_max_duration)^2

The cost must be nonnegative.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |