@@ -15,48 +15,6 @@ $client->getTimetable($getTimetableParametersObject);
1515
1616```
1717
18- ### Example with ValueObjects
19-
20- ``` php
21- <?php
22-
23- use DateTimeImmutable;
24- use TK\SDK\ValueObject\Location;
25- use TK\SDK\ValueObject\DepartureDateTime;
26- use TK\SDK\ValueObject\OriginDestinationInformation;
27- use TK\SDK\ValueObject\AirScheduleRQ;
28- use TK\SDK\ValueObject\GetTimetableParameters;
29-
30- $originLocation = new Location('IST', Location::MULTIPLE_AIRPORT_TRUE);
31- $destinationLocation = new Location('JFK', Location::MULTIPLE_AIRPORT_TRUE);
32- $departureTime = gmdate('Y-m-d H:i:s', strtotime('+4 days'));
33-
34- $departureDateTime = new DepartureDateTime(
35- new DateTimeImmutable($departureTime),
36- 'P3D',
37- 'P3D'
38- );
39-
40- $originDestinationInformation = new OriginDestinationInformation(
41- $departureDateTime,
42- $originLocation,
43- $destinationLocation
44- );
45-
46- $airScheduleRQ = (new AirScheduleRQ($originDestinationInformation))
47- ->withAirlineCode(AirScheduleRQ::AIRLINE_TURKISH_AIRLINES)
48- ->withDirectAndNonStopOnlyInd();
49-
50- $getTimetableParametersObject = new GetTimetableParameters(
51- $airScheduleRQ,
52- GetTimetableParameters::SCHEDULE_TYPE_WEEKLY,
53- GetTimetableParameters::TRIP_TYPE_ONE_WAY
54- );
55-
56- $response = $client->getTimetable($getTimetableParametersObject);
57-
58- ```
59-
6018### Example with Factory Using JSON Query
6119
6220``` php
@@ -112,4 +70,46 @@ $getTimetableParametersObject = GetTimetableParametersFactory::createFromArray($
11270
11371$response = $client->getTimetable($getTimetableParametersObject);
11472
115- ```
73+ ```
74+
75+ ### Example with ValueObjects (Recomended)
76+
77+ ``` php
78+ <?php
79+
80+ use DateTimeImmutable;
81+ use TK\SDK\ValueObject\Location;
82+ use TK\SDK\ValueObject\DepartureDateTime;
83+ use TK\SDK\ValueObject\OriginDestinationInformation;
84+ use TK\SDK\ValueObject\AirScheduleRQ;
85+ use TK\SDK\ValueObject\GetTimetableParameters;
86+
87+ $originLocation = new Location('IST', Location::MULTIPLE_AIRPORT_TRUE);
88+ $destinationLocation = new Location('JFK', Location::MULTIPLE_AIRPORT_TRUE);
89+ $departureTime = gmdate('Y-m-d H:i:s', strtotime('+4 days'));
90+
91+ $departureDateTime = new DepartureDateTime(
92+ new DateTimeImmutable($departureTime),
93+ 'P3D',
94+ 'P3D'
95+ );
96+
97+ $originDestinationInformation = new OriginDestinationInformation(
98+ $departureDateTime,
99+ $originLocation,
100+ $destinationLocation
101+ );
102+
103+ $airScheduleRQ = (new AirScheduleRQ($originDestinationInformation))
104+ ->withAirlineCode(AirScheduleRQ::AIRLINE_TURKISH_AIRLINES)
105+ ->withDirectAndNonStopOnlyInd();
106+
107+ $getTimetableParametersObject = new GetTimetableParameters(
108+ $airScheduleRQ,
109+ GetTimetableParameters::SCHEDULE_TYPE_WEEKLY,
110+ GetTimetableParameters::TRIP_TYPE_ONE_WAY
111+ );
112+
113+ $response = $client->getTimetable($getTimetableParametersObject);
114+
115+ ```
0 commit comments