@@ -22,28 +22,6 @@ final class CalculateRouteMatrixRequest extends Input
2222 */
2323 private $ calculatorName ;
2424
25- /**
26- * Specifies route preferences when traveling by `Car`, such as avoiding routes that use ferries or tolls.
27- *
28- * Requirements: `TravelMode` must be specified as `Car`.
29- *
30- * @var CalculateRouteCarModeOptions|null
31- */
32- private $ carModeOptions ;
33-
34- /**
35- * Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You can't set
36- * both `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic
37- * conditions is used to calculate the route matrix.
38- *
39- * Default Value: `false`
40- *
41- * Valid Values: `false` | `true`
42- *
43- * @var bool|null
44- */
45- private $ departNow ;
46-
4725 /**
4826 * The list of departure (origin) positions for the route matrix. An array of points, each of which is itself a 2-value
4927 * array defined in WGS 84 [^1] format: `[longitude, latitude]`. For example, `[-123.115, 49.285]`.
@@ -67,21 +45,6 @@ final class CalculateRouteMatrixRequest extends Input
6745 */
6846 private $ departurePositions ;
6947
70- /**
71- * Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set both
72- * `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic conditions
73- * is used to calculate the route matrix.
74- *
75- * > Setting a departure time in the past returns a `400 ValidationException` error.
76- *
77- * - In ISO 8601 [^1] format: `YYYY-MM-DDThh:mm:ss.sssZ`. For example, `2020–07-2T12:15:20.000Z+01:00`
78- *
79- * [^1]: https://www.iso.org/iso-8601-date-and-time-format.html
80- *
81- * @var \DateTimeImmutable|null
82- */
83- private $ departureTime ;
84-
8548 /**
8649 * The list of destination positions for the route matrix. An array of points, each of which is itself a 2-value array
8750 * defined in WGS 84 [^1] format: `[longitude, latitude]`. For example, `[-122.339, 47.615]`.
@@ -105,24 +68,6 @@ final class CalculateRouteMatrixRequest extends Input
10568 */
10669 private $ destinationPositions ;
10770
108- /**
109- * Set the unit system to specify the distance.
110- *
111- * Default Value: `Kilometers`
112- *
113- * @var DistanceUnit::*|null
114- */
115- private $ distanceUnit ;
116-
117- /**
118- * The optional API key [^1] to authorize the request.
119- *
120- * [^1]: https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html
121- *
122- * @var string|null
123- */
124- private $ key ;
125-
12671 /**
12772 * Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road
12873 * compatibility.
@@ -147,6 +92,52 @@ final class CalculateRouteMatrixRequest extends Input
14792 */
14893 private $ travelMode ;
14994
95+ /**
96+ * Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set both
97+ * `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic conditions
98+ * is used to calculate the route matrix.
99+ *
100+ * > Setting a departure time in the past returns a `400 ValidationException` error.
101+ *
102+ * - In ISO 8601 [^1] format: `YYYY-MM-DDThh:mm:ss.sssZ`. For example, `2020–07-2T12:15:20.000Z+01:00`
103+ *
104+ * [^1]: https://www.iso.org/iso-8601-date-and-time-format.html
105+ *
106+ * @var \DateTimeImmutable|null
107+ */
108+ private $ departureTime ;
109+
110+ /**
111+ * Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You can't set
112+ * both `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic
113+ * conditions is used to calculate the route matrix.
114+ *
115+ * Default Value: `false`
116+ *
117+ * Valid Values: `false` | `true`
118+ *
119+ * @var bool|null
120+ */
121+ private $ departNow ;
122+
123+ /**
124+ * Set the unit system to specify the distance.
125+ *
126+ * Default Value: `Kilometers`
127+ *
128+ * @var DistanceUnit::*|null
129+ */
130+ private $ distanceUnit ;
131+
132+ /**
133+ * Specifies route preferences when traveling by `Car`, such as avoiding routes that use ferries or tolls.
134+ *
135+ * Requirements: `TravelMode` must be specified as `Car`.
136+ *
137+ * @var CalculateRouteCarModeOptions|null
138+ */
139+ private $ carModeOptions ;
140+
150141 /**
151142 * Specifies route preferences when traveling by `Truck`, such as avoiding routes that use ferries or tolls, and truck
152143 * specifications to consider when choosing an optimal road.
@@ -157,48 +148,57 @@ final class CalculateRouteMatrixRequest extends Input
157148 */
158149 private $ truckModeOptions ;
159150
151+ /**
152+ * The optional API key [^1] to authorize the request.
153+ *
154+ * [^1]: https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html
155+ *
156+ * @var string|null
157+ */
158+ private $ key ;
159+
160160 /**
161161 * @param array{
162162 * CalculatorName?: string,
163- * CarModeOptions?: null|CalculateRouteCarModeOptions|array,
164- * DepartNow?: null|bool,
165163 * DeparturePositions?: array[],
166- * DepartureTime?: null|\DateTimeImmutable|string,
167164 * DestinationPositions?: array[],
168- * DistanceUnit?: null|DistanceUnit::*,
169- * Key?: null|string,
170165 * TravelMode?: null|TravelMode::*,
166+ * DepartureTime?: null|\DateTimeImmutable|string,
167+ * DepartNow?: null|bool,
168+ * DistanceUnit?: null|DistanceUnit::*,
169+ * CarModeOptions?: null|CalculateRouteCarModeOptions|array,
171170 * TruckModeOptions?: null|CalculateRouteTruckModeOptions|array,
171+ * Key?: null|string,
172172 * '@region'?: string|null,
173173 * } $input
174174 */
175175 public function __construct (array $ input = [])
176176 {
177177 $ this ->calculatorName = $ input ['CalculatorName ' ] ?? null ;
178- $ this ->carModeOptions = isset ($ input ['CarModeOptions ' ]) ? CalculateRouteCarModeOptions::create ($ input ['CarModeOptions ' ]) : null ;
179- $ this ->departNow = $ input ['DepartNow ' ] ?? null ;
180178 $ this ->departurePositions = $ input ['DeparturePositions ' ] ?? null ;
181- $ this ->departureTime = !isset ($ input ['DepartureTime ' ]) ? null : ($ input ['DepartureTime ' ] instanceof \DateTimeImmutable ? $ input ['DepartureTime ' ] : new \DateTimeImmutable ($ input ['DepartureTime ' ]));
182179 $ this ->destinationPositions = $ input ['DestinationPositions ' ] ?? null ;
183- $ this ->distanceUnit = $ input ['DistanceUnit ' ] ?? null ;
184- $ this ->key = $ input ['Key ' ] ?? null ;
185180 $ this ->travelMode = $ input ['TravelMode ' ] ?? null ;
181+ $ this ->departureTime = !isset ($ input ['DepartureTime ' ]) ? null : ($ input ['DepartureTime ' ] instanceof \DateTimeImmutable ? $ input ['DepartureTime ' ] : new \DateTimeImmutable ($ input ['DepartureTime ' ]));
182+ $ this ->departNow = $ input ['DepartNow ' ] ?? null ;
183+ $ this ->distanceUnit = $ input ['DistanceUnit ' ] ?? null ;
184+ $ this ->carModeOptions = isset ($ input ['CarModeOptions ' ]) ? CalculateRouteCarModeOptions::create ($ input ['CarModeOptions ' ]) : null ;
186185 $ this ->truckModeOptions = isset ($ input ['TruckModeOptions ' ]) ? CalculateRouteTruckModeOptions::create ($ input ['TruckModeOptions ' ]) : null ;
186+ $ this ->key = $ input ['Key ' ] ?? null ;
187187 parent ::__construct ($ input );
188188 }
189189
190190 /**
191191 * @param array{
192192 * CalculatorName?: string,
193- * CarModeOptions?: null|CalculateRouteCarModeOptions|array,
194- * DepartNow?: null|bool,
195193 * DeparturePositions?: array[],
196- * DepartureTime?: null|\DateTimeImmutable|string,
197194 * DestinationPositions?: array[],
198- * DistanceUnit?: null|DistanceUnit::*,
199- * Key?: null|string,
200195 * TravelMode?: null|TravelMode::*,
196+ * DepartureTime?: null|\DateTimeImmutable|string,
197+ * DepartNow?: null|bool,
198+ * DistanceUnit?: null|DistanceUnit::*,
199+ * CarModeOptions?: null|CalculateRouteCarModeOptions|array,
201200 * TruckModeOptions?: null|CalculateRouteTruckModeOptions|array,
201+ * Key?: null|string,
202202 * '@region'?: string|null,
203203 * }|CalculateRouteMatrixRequest $input
204204 */
@@ -388,12 +388,6 @@ private function requestBody(): array
388388 {
389389 $ payload = [];
390390
391- if (null !== $ v = $ this ->carModeOptions ) {
392- $ payload ['CarModeOptions ' ] = $ v ->requestBody ();
393- }
394- if (null !== $ v = $ this ->departNow ) {
395- $ payload ['DepartNow ' ] = (bool ) $ v ;
396- }
397391 if (null === $ v = $ this ->departurePositions ) {
398392 throw new InvalidArgument (sprintf ('Missing parameter "DeparturePositions" for "%s". The value cannot be null. ' , __CLASS__ ));
399393 }
@@ -411,9 +405,6 @@ private function requestBody(): array
411405 }
412406 }
413407
414- if (null !== $ v = $ this ->departureTime ) {
415- $ payload ['DepartureTime ' ] = $ v ->format (\DateTimeInterface::ATOM );
416- }
417408 if (null === $ v = $ this ->destinationPositions ) {
418409 throw new InvalidArgument (sprintf ('Missing parameter "DestinationPositions" for "%s". The value cannot be null. ' , __CLASS__ ));
419410 }
@@ -431,18 +422,26 @@ private function requestBody(): array
431422 }
432423 }
433424
425+ if (null !== $ v = $ this ->travelMode ) {
426+ if (!TravelMode::exists ($ v )) {
427+ throw new InvalidArgument (sprintf ('Invalid parameter "TravelMode" for "%s". The value "%s" is not a valid "TravelMode". ' , __CLASS__ , $ v ));
428+ }
429+ $ payload ['TravelMode ' ] = $ v ;
430+ }
431+ if (null !== $ v = $ this ->departureTime ) {
432+ $ payload ['DepartureTime ' ] = $ v ->format (\DateTimeInterface::ATOM );
433+ }
434+ if (null !== $ v = $ this ->departNow ) {
435+ $ payload ['DepartNow ' ] = (bool ) $ v ;
436+ }
434437 if (null !== $ v = $ this ->distanceUnit ) {
435438 if (!DistanceUnit::exists ($ v )) {
436439 throw new InvalidArgument (sprintf ('Invalid parameter "DistanceUnit" for "%s". The value "%s" is not a valid "DistanceUnit". ' , __CLASS__ , $ v ));
437440 }
438441 $ payload ['DistanceUnit ' ] = $ v ;
439442 }
440-
441- if (null !== $ v = $ this ->travelMode ) {
442- if (!TravelMode::exists ($ v )) {
443- throw new InvalidArgument (sprintf ('Invalid parameter "TravelMode" for "%s". The value "%s" is not a valid "TravelMode". ' , __CLASS__ , $ v ));
444- }
445- $ payload ['TravelMode ' ] = $ v ;
443+ if (null !== $ v = $ this ->carModeOptions ) {
444+ $ payload ['CarModeOptions ' ] = $ v ->requestBody ();
446445 }
447446 if (null !== $ v = $ this ->truckModeOptions ) {
448447 $ payload ['TruckModeOptions ' ] = $ v ->requestBody ();
0 commit comments