From ac713f42c53733c9a06a4edbc8ae60265dc4d739 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 02:27:14 +0000 Subject: [PATCH 1/5] Initial plan From 12fb803cf3d33c010b68f41dcfac5f03dde55c18 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 02:36:44 +0000 Subject: [PATCH 2/5] feat: Add GTFS-Realtime PHP library with proto3 support for PHP 8.4+ Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/7cc63a2c-3e17-479e-8d6c-bfca1ee08d49 Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com> --- .gitignore | 4 + LICENSE | 180 ++++++ README.md | 124 +++- composer.json | 25 + examples/create_message.php | 76 +++ examples/parse_message.php | 70 +++ gtfs-realtime.proto | 403 +++++++++++++ phpunit.xml | 17 + src/GPBMetadata/GtfsRealtime.php | Bin 0 -> 7986 bytes src/Google/Transit/Realtime/Alert.php | 529 ++++++++++++++++++ src/Google/Transit/Realtime/Alert/Cause.php | 101 ++++ src/Google/Transit/Realtime/Alert/Effect.php | 96 ++++ .../Transit/Realtime/Alert/SeverityLevel.php | 61 ++ src/Google/Transit/Realtime/Alert_Cause.php | 16 + src/Google/Transit/Realtime/Alert_Effect.php | 16 + .../Transit/Realtime/Alert_SeverityLevel.php | 16 + .../Transit/Realtime/EntitySelector.php | 205 +++++++ src/Google/Transit/Realtime/FeedEntity.php | 316 +++++++++++ src/Google/Transit/Realtime/FeedHeader.php | 141 +++++ .../Realtime/FeedHeader/Incrementality.php | 51 ++ .../Realtime/FeedHeader_Incrementality.php | 16 + src/Google/Transit/Realtime/FeedMessage.php | 97 ++++ src/Google/Transit/Realtime/Position.php | 168 ++++++ .../Transit/Realtime/ReplacementStop.php | 87 +++ src/Google/Transit/Realtime/Shape.php | 88 +++ src/Google/Transit/Realtime/Stop.php | 472 ++++++++++++++++ .../Realtime/Stop/WheelchairBoarding.php | 56 ++ src/Google/Transit/Realtime/StopSelector.php | 88 +++ .../Realtime/Stop_WheelchairBoarding.php | 16 + src/Google/Transit/Realtime/TimeRange.php | 87 +++ .../Transit/Realtime/TranslatedImage.php | 61 ++ .../TranslatedImage/LocalizedImage.php | 115 ++++ .../TranslatedImage_LocalizedImage.php | 16 + .../Transit/Realtime/TranslatedString.php | 60 ++ .../Realtime/TranslatedString/Translation.php | 88 +++ .../Realtime/TranslatedString_Translation.php | 16 + .../Transit/Realtime/TripDescriptor.php | 239 ++++++++ .../TripDescriptor/ModifiedTripSelector.php | 142 +++++ .../TripDescriptor/ScheduleRelationship.php | 93 +++ .../TripDescriptor_ModifiedTripSelector.php | 16 + .../TripDescriptor_ScheduleRelationship.php | 16 + .../Transit/Realtime/TripModifications.php | 141 +++++ .../TripModifications/Modification.php | 216 +++++++ .../TripModifications/SelectedTrips.php | 88 +++ .../TripModifications_Modification.php | 16 + .../TripModifications_SelectedTrips.php | 16 + src/Google/Transit/Realtime/TripUpdate.php | 232 ++++++++ .../Realtime/TripUpdate/StopTimeEvent.php | 149 +++++ .../Realtime/TripUpdate/StopTimeUpdate.php | 260 +++++++++ .../StopTimeUpdate/ScheduleRelationship.php | 63 +++ .../StopTimeUpdate/StopTimeProperties.php | 165 ++++++ .../StopTimeProperties/DropOffPickupType.php | 61 ++ .../Realtime/TripUpdate/TripProperties.php | 212 +++++++ .../Realtime/TripUpdate_StopTimeEvent.php | 16 + .../Realtime/TripUpdate_StopTimeUpdate.php | 16 + ...te_StopTimeUpdate_ScheduleRelationship.php | 16 + ...date_StopTimeUpdate_StopTimeProperties.php | 16 + ...e_StopTimeProperties_DropOffPickupType.php | 16 + .../Realtime/TripUpdate_TripProperties.php | 16 + .../Transit/Realtime/VehicleDescriptor.php | 141 +++++ .../WheelchairAccessible.php | 61 ++ ...VehicleDescriptor_WheelchairAccessible.php | 16 + .../Transit/Realtime/VehiclePosition.php | 374 +++++++++++++ .../VehiclePosition/CarriageDetails.php | 171 ++++++ .../VehiclePosition/CongestionLevel.php | 66 +++ .../VehiclePosition/OccupancyStatus.php | 90 +++ .../VehiclePosition/VehicleStopStatus.php | 56 ++ .../VehiclePosition_CarriageDetails.php | 16 + .../VehiclePosition_CongestionLevel.php | 16 + .../VehiclePosition_OccupancyStatus.php | 16 + .../VehiclePosition_VehicleStopStatus.php | 16 + tests/GtfsRealtimeTest.php | 277 +++++++++ 72 files changed, 7514 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 composer.json create mode 100644 examples/create_message.php create mode 100644 examples/parse_message.php create mode 100644 gtfs-realtime.proto create mode 100644 phpunit.xml create mode 100644 src/GPBMetadata/GtfsRealtime.php create mode 100644 src/Google/Transit/Realtime/Alert.php create mode 100644 src/Google/Transit/Realtime/Alert/Cause.php create mode 100644 src/Google/Transit/Realtime/Alert/Effect.php create mode 100644 src/Google/Transit/Realtime/Alert/SeverityLevel.php create mode 100644 src/Google/Transit/Realtime/Alert_Cause.php create mode 100644 src/Google/Transit/Realtime/Alert_Effect.php create mode 100644 src/Google/Transit/Realtime/Alert_SeverityLevel.php create mode 100644 src/Google/Transit/Realtime/EntitySelector.php create mode 100644 src/Google/Transit/Realtime/FeedEntity.php create mode 100644 src/Google/Transit/Realtime/FeedHeader.php create mode 100644 src/Google/Transit/Realtime/FeedHeader/Incrementality.php create mode 100644 src/Google/Transit/Realtime/FeedHeader_Incrementality.php create mode 100644 src/Google/Transit/Realtime/FeedMessage.php create mode 100644 src/Google/Transit/Realtime/Position.php create mode 100644 src/Google/Transit/Realtime/ReplacementStop.php create mode 100644 src/Google/Transit/Realtime/Shape.php create mode 100644 src/Google/Transit/Realtime/Stop.php create mode 100644 src/Google/Transit/Realtime/Stop/WheelchairBoarding.php create mode 100644 src/Google/Transit/Realtime/StopSelector.php create mode 100644 src/Google/Transit/Realtime/Stop_WheelchairBoarding.php create mode 100644 src/Google/Transit/Realtime/TimeRange.php create mode 100644 src/Google/Transit/Realtime/TranslatedImage.php create mode 100644 src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php create mode 100644 src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php create mode 100644 src/Google/Transit/Realtime/TranslatedString.php create mode 100644 src/Google/Transit/Realtime/TranslatedString/Translation.php create mode 100644 src/Google/Transit/Realtime/TranslatedString_Translation.php create mode 100644 src/Google/Transit/Realtime/TripDescriptor.php create mode 100644 src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php create mode 100644 src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php create mode 100644 src/Google/Transit/Realtime/TripDescriptor_ModifiedTripSelector.php create mode 100644 src/Google/Transit/Realtime/TripDescriptor_ScheduleRelationship.php create mode 100644 src/Google/Transit/Realtime/TripModifications.php create mode 100644 src/Google/Transit/Realtime/TripModifications/Modification.php create mode 100644 src/Google/Transit/Realtime/TripModifications/SelectedTrips.php create mode 100644 src/Google/Transit/Realtime/TripModifications_Modification.php create mode 100644 src/Google/Transit/Realtime/TripModifications_SelectedTrips.php create mode 100644 src/Google/Transit/Realtime/TripUpdate.php create mode 100644 src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php create mode 100644 src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php create mode 100644 src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php create mode 100644 src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.php create mode 100644 src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php create mode 100644 src/Google/Transit/Realtime/TripUpdate/TripProperties.php create mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php create mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate.php create mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate_ScheduleRelationship.php create mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate_StopTimeProperties.php create mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate_StopTimeProperties_DropOffPickupType.php create mode 100644 src/Google/Transit/Realtime/TripUpdate_TripProperties.php create mode 100644 src/Google/Transit/Realtime/VehicleDescriptor.php create mode 100644 src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php create mode 100644 src/Google/Transit/Realtime/VehicleDescriptor_WheelchairAccessible.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition/OccupancyStatus.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition/VehicleStopStatus.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition_CarriageDetails.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition_CongestionLevel.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition_OccupancyStatus.php create mode 100644 src/Google/Transit/Realtime/VehiclePosition_VehicleStopStatus.php create mode 100644 tests/GtfsRealtimeTest.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9673080 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +examples/feed.pb +.phpunit.result.cache diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0c04d3a --- /dev/null +++ b/LICENSE @@ -0,0 +1,180 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship made available under + the License, as indicated by a copyright notice that is included in + or attached with the work (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other transformations + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean, as submitted to the Licensor for inclusion + in the Work by the copyright owner or by an individual or Legal Entity + authorized to submit on behalf of the copyright owner. For the purposes + of this definition, "submit" means any form of electronic, verbal, or + written communication sent to the Licensor or its representatives, + including but not limited to communication on electronic mailing lists, + source code control systems, and issue tracking systems that are managed + by, or on behalf of, the Licensor for the purpose of developing and + improving the Work, but excluding communication that is conspicuously + marked or designated in writing by the copyright owner as "Not a + Contribution." + + "Contributor" shall mean Licensor and any Legal Entity on behalf of + whom a Contribution has been received by the Licensor and included + within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent contributions + Licensors by such Contributor that are necessarily infringed by their + Contribution(s) alone or by the combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a cross-claim + or counterclaim in a lawsuit) alleging that the Work or any + Contribution embodied within the Work constitutes direct or contributory + patent infringement, then any patent licenses granted to You under this + License for that Work shall terminate as of the date such litigation is + filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative + Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then You must include a readable copy of the + attribution notices contained within such NOTICE file, in + at least one of the following places: within a NOTICE text + file distributed as part of the Derivative Works; within + the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the + Derivative Works, if and wherever such third-party notices + normally appear. The contents of the NOTICE file are for + informational purposes only and do not modify the License. + You may add Your own attribution notices within Derivative + Works that You distribute, alongside or in addition to the + NOTICE text from the Work, provided that such additional + attribution notices cannot be construed as modifying the License. + + You may add Your own license statement for Your modifications and + may provide additional grant of rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Work, + and to permit persons to whom the Work is furnished to do so, + subject to the following conditions. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or reproducing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or exemplary damages of any character arising as a + result of this License or out of the use or inability to use the + Work (even if such Contributor has been advised of the possibility + of such damages). + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may offer only + conditions consistent with this License in a way that is a separate + agreement with recipients to not impose those restrictions on other + recipients of the Work. + + END OF TERMS AND CONDITIONS + + Copyright 2015 The GTFS Specifications Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index c889c8c..ff11624 100644 --- a/README.md +++ b/README.md @@ -1 +1,123 @@ -# gtfs-rt-php \ No newline at end of file +# gtfs-rt-php + +GTFS-Realtime library for PHP 8.4+ based on Google's [Protocol Buffers](https://github.com/protocolbuffers/protobuf) v5. + +A modern PHP implementation of the [GTFS Realtime](https://gtfs.org/documentation/realtime/reference/) specification. +The proto definition was downloaded from [gtfs.org](https://gtfs.org/documentation/realtime/gtfs-realtime.proto) and converted to proto3 syntax for compatibility with the latest `google/protobuf` PHP library. + +## Requirements + +- PHP >= 8.4 +- [google/protobuf](https://packagist.org/packages/google/protobuf) ^5.34 + +## Installation + +```bash +composer require dacoto/gtfs-rt-php +``` + +## Usage + +### Creating a Feed Message + +```php +use Google\Transit\Realtime\FeedMessage; +use Google\Transit\Realtime\FeedHeader; +use Google\Transit\Realtime\FeedHeader\Incrementality; +use Google\Transit\Realtime\FeedEntity; +use Google\Transit\Realtime\TripUpdate; +use Google\Transit\Realtime\TripUpdate\StopTimeUpdate; +use Google\Transit\Realtime\TripUpdate\StopTimeEvent; +use Google\Transit\Realtime\TripDescriptor; + +$feedMessage = new FeedMessage(); + +$header = new FeedHeader(); +$header->setGtfsRealtimeVersion('2.0'); +$header->setIncrementality(Incrementality::FULL_DATASET); +$header->setTimestamp(time()); +$feedMessage->setHeader($header); + +$entity = new FeedEntity(); +$entity->setId('entity-1'); + +$tripDescriptor = new TripDescriptor(); +$tripDescriptor->setTripId('trip-123'); +$tripDescriptor->setRouteId('route-42'); + +$arrivalEvent = new StopTimeEvent(); +$arrivalEvent->setDelay(120); // 2 minutes late + +$stopTimeUpdate = new StopTimeUpdate(); +$stopTimeUpdate->setStopSequence(1); +$stopTimeUpdate->setStopId('stop-A'); +$stopTimeUpdate->setArrival($arrivalEvent); + +$tripUpdate = new TripUpdate(); +$tripUpdate->setTrip($tripDescriptor); +$tripUpdate->setStopTimeUpdate([$stopTimeUpdate]); + +$entity->setTripUpdate($tripUpdate); +$feedMessage->setEntity([$entity]); + +// Serialize to binary protobuf +$binaryData = $feedMessage->serializeToString(); +``` + +### Parsing a Feed Message + +```php +use Google\Transit\Realtime\FeedMessage; + +$binaryData = file_get_contents('https://your-agency.com/gtfs-rt/tripupdates.pb'); + +$feedMessage = new FeedMessage(); +$feedMessage->mergeFromString($binaryData); + +echo "GTFS-RT version: " . $feedMessage->getHeader()->getGtfsRealtimeVersion() . PHP_EOL; + +foreach ($feedMessage->getEntity() as $entity) { + if ($entity->hasTripUpdate()) { + $tripUpdate = $entity->getTripUpdate(); + echo "Trip ID: " . $tripUpdate->getTrip()->getTripId() . PHP_EOL; + + foreach ($tripUpdate->getStopTimeUpdate() as $stu) { + if ($stu->hasArrival()) { + echo " Stop " . $stu->getStopId() . " delay: " . $stu->getArrival()->getDelay() . "s" . PHP_EOL; + } + } + } +} +``` + +See full examples in the [examples/](examples/) directory. + +## Proto3 Conversion Notes + +The official GTFS Realtime proto uses `proto2` syntax. This library converts it to `proto3` to be compatible with the latest `google/protobuf` PHP library. The key changes are: + +1. Changed `syntax = "proto2"` to `syntax = "proto3"` +2. Removed all `optional` and `required` field labels (all fields are optional in proto3) +3. Removed all `extensions` ranges (not supported in proto3) +4. Removed all explicit `[default = ...]` values +5. Added `UNKNOWN_CAUSE = 0`, `NO_SERVICE = 0`, and `UNKNOWN_SEVERITY = 0` as first enum values (proto3 requires first value to be 0) +6. Added PHP namespace options: `php_namespace` and `php_metadata_namespace` + +## Running Tests + +```bash +composer install +vendor/bin/phpunit +``` + +## Regenerating PHP Classes + +If you need to regenerate the PHP classes from the proto file: + +```bash +protoc --php_out=src -I . gtfs-realtime.proto +``` + +## License + +Apache 2.0 — See [LICENSE](LICENSE) \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..6f07009 --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "dacoto/gtfs-rt-php", + "type": "library", + "description": "GTFS-Realtime library for PHP 8.4+ based on Google Protocol Buffers v5", + "keywords": ["gtfs", "gtfs-realtime", "protobuf", "transit"], + "license": "Apache-2.0", + "require": { + "php": ">=8.4", + "google/protobuf": "^5.34" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "autoload": { + "psr-4": { + "Google\\Transit\\Realtime\\": "src/Google/Transit/Realtime", + "GPBMetadata\\": "src/GPBMetadata" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + } +} diff --git a/examples/create_message.php b/examples/create_message.php new file mode 100644 index 0000000..067faff --- /dev/null +++ b/examples/create_message.php @@ -0,0 +1,76 @@ +setGtfsRealtimeVersion('2.0'); +$header->setIncrementality(Incrementality::FULL_DATASET); +$header->setTimestamp(time()); +$feedMessage->setHeader($header); + +// Create a feed entity with a trip update +$entity = new FeedEntity(); +$entity->setId('entity-1'); + +// Create a trip descriptor +$tripDescriptor = new TripDescriptor(); +$tripDescriptor->setTripId('trip-123'); +$tripDescriptor->setRouteId('route-42'); +$tripDescriptor->setStartDate('20260328'); + +// Create a trip update +$tripUpdate = new TripUpdate(); +$tripUpdate->setTrip($tripDescriptor); +$tripUpdate->setTimestamp(time()); + +// Add stop time updates +$arrivalEvent = new StopTimeEvent(); +$arrivalEvent->setDelay(120); // 2 minutes late + +$departureEvent = new StopTimeEvent(); +$departureEvent->setDelay(120); + +$stopTimeUpdate = new StopTimeUpdate(); +$stopTimeUpdate->setStopSequence(1); +$stopTimeUpdate->setStopId('stop-A'); +$stopTimeUpdate->setArrival($arrivalEvent); +$stopTimeUpdate->setDeparture($departureEvent); + +$tripUpdate->setStopTimeUpdate([$stopTimeUpdate]); +$entity->setTripUpdate($tripUpdate); + +// Add entity to the feed message +$feedMessage->setEntity([$entity]); + +// Serialize to binary protobuf +$binaryData = $feedMessage->serializeToString(); + +echo "Feed message created successfully." . PHP_EOL; +echo "Binary size: " . strlen($binaryData) . " bytes" . PHP_EOL; +echo "Number of entities: " . count($feedMessage->getEntity()) . PHP_EOL; +echo "GTFS-RT version: " . $feedMessage->getHeader()->getGtfsRealtimeVersion() . PHP_EOL; +echo "Trip ID: " . $feedMessage->getEntity()[0]->getTripUpdate()->getTrip()->getTripId() . PHP_EOL; +echo "Arrival delay: " . $feedMessage->getEntity()[0]->getTripUpdate()->getStopTimeUpdate()[0]->getArrival()->getDelay() . " seconds" . PHP_EOL; + +// Save to file for use in parse_message.php example +file_put_contents(__DIR__ . '/feed.pb', $binaryData); +echo "Binary feed saved to examples/feed.pb" . PHP_EOL; diff --git a/examples/parse_message.php b/examples/parse_message.php new file mode 100644 index 0000000..6860220 --- /dev/null +++ b/examples/parse_message.php @@ -0,0 +1,70 @@ +mergeFromString($binaryData); + +echo "Feed message parsed successfully." . PHP_EOL; +echo "GTFS-RT version: " . $feedMessage->getHeader()->getGtfsRealtimeVersion() . PHP_EOL; +echo "Timestamp: " . $feedMessage->getHeader()->getTimestamp() . PHP_EOL; +echo "Number of entities: " . count($feedMessage->getEntity()) . PHP_EOL; + +foreach ($feedMessage->getEntity() as $entity) { + echo PHP_EOL . "Entity ID: " . $entity->getId() . PHP_EOL; + + if ($entity->hasTripUpdate()) { + $tripUpdate = $entity->getTripUpdate(); + echo " Trip ID: " . $tripUpdate->getTrip()->getTripId() . PHP_EOL; + echo " Route ID: " . $tripUpdate->getTrip()->getRouteId() . PHP_EOL; + + foreach ($tripUpdate->getStopTimeUpdate() as $stu) { + echo " Stop: " . $stu->getStopId() . " (seq " . $stu->getStopSequence() . ")" . PHP_EOL; + if ($stu->hasArrival()) { + echo " Arrival delay: " . $stu->getArrival()->getDelay() . "s" . PHP_EOL; + } + if ($stu->hasDeparture()) { + echo " Departure delay: " . $stu->getDeparture()->getDelay() . "s" . PHP_EOL; + } + } + } + + if ($entity->hasVehicle()) { + $vehicle = $entity->getVehicle(); + echo " Vehicle ID: " . $vehicle->getVehicle()->getId() . PHP_EOL; + if ($vehicle->hasPosition()) { + echo " Position: lat=" . $vehicle->getPosition()->getLatitude() + . " lon=" . $vehicle->getPosition()->getLongitude() . PHP_EOL; + } + } + + if ($entity->hasAlert()) { + $alert = $entity->getAlert(); + if ($alert->hasHeaderText()) { + foreach ($alert->getHeaderText()->getTranslation() as $translation) { + echo " Alert header [" . $translation->getLanguage() . "]: " . $translation->getText() . PHP_EOL; + } + } + } +} diff --git a/gtfs-realtime.proto b/gtfs-realtime.proto new file mode 100644 index 0000000..f7a6881 --- /dev/null +++ b/gtfs-realtime.proto @@ -0,0 +1,403 @@ +// Copyright 2015 The GTFS Specifications Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Protocol definition file for GTFS Realtime (converted to proto3). +// Source: https://gtfs.org/documentation/realtime/gtfs-realtime.proto + +syntax = "proto3"; +option java_package = "com.google.transit.realtime"; +option php_namespace = "Google\\Transit\\Realtime"; +option php_metadata_namespace = "GPBMetadata"; +package transit_realtime; + +// The contents of a feed message. +message FeedMessage { + FeedHeader header = 1; + repeated FeedEntity entity = 2; +} + +// Metadata about a feed, included in feed messages. +message FeedHeader { + string gtfs_realtime_version = 1; + + enum Incrementality { + FULL_DATASET = 0; + DIFFERENTIAL = 1; + } + Incrementality incrementality = 2; + + uint64 timestamp = 3; + string feed_version = 4; +} + +// A definition (or update) of an entity in the transit feed. +message FeedEntity { + string id = 1; + bool is_deleted = 2; + TripUpdate trip_update = 3; + VehiclePosition vehicle = 4; + Alert alert = 5; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + Shape shape = 6; + Stop stop = 7; + TripModifications trip_modifications = 8; +} + +// Realtime update of the progress of a vehicle along a trip. +message TripUpdate { + TripDescriptor trip = 1; + VehicleDescriptor vehicle = 3; + + message StopTimeEvent { + int32 delay = 1; + int64 time = 2; + int32 uncertainty = 3; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + int64 scheduled_time = 4; + } + + message StopTimeUpdate { + uint32 stop_sequence = 1; + string stop_id = 4; + StopTimeEvent arrival = 2; + StopTimeEvent departure = 3; + VehiclePosition.OccupancyStatus departure_occupancy_status = 7; + + enum ScheduleRelationship { + SCHEDULED = 0; + SKIPPED = 1; + NO_DATA = 2; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + UNSCHEDULED = 3; + } + ScheduleRelationship schedule_relationship = 5; + + // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. + message StopTimeProperties { + string assigned_stop_id = 1; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + string stop_headsign = 2; + + enum DropOffPickupType { + REGULAR = 0; + NONE = 1; + PHONE_AGENCY = 2; + COORDINATE_WITH_DRIVER = 3; + } + + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + DropOffPickupType pickup_type = 3; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + DropOffPickupType drop_off_type = 4; + } + + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + StopTimeProperties stop_time_properties = 6; + } + + repeated StopTimeUpdate stop_time_update = 2; + uint64 timestamp = 4; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + int32 delay = 5; + + // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. + message TripProperties { + string trip_id = 1; + string start_date = 2; + string start_time = 3; + string shape_id = 4; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + string trip_headsign = 5; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + string trip_short_name = 6; + } + TripProperties trip_properties = 6; +} + +// Realtime positioning information for a given vehicle. +message VehiclePosition { + TripDescriptor trip = 1; + VehicleDescriptor vehicle = 8; + Position position = 2; + uint32 current_stop_sequence = 3; + string stop_id = 7; + + enum VehicleStopStatus { + INCOMING_AT = 0; + STOPPED_AT = 1; + IN_TRANSIT_TO = 2; + } + VehicleStopStatus current_status = 4; + + uint64 timestamp = 5; + + enum CongestionLevel { + UNKNOWN_CONGESTION_LEVEL = 0; + RUNNING_SMOOTHLY = 1; + STOP_AND_GO = 2; + CONGESTION = 3; + SEVERE_CONGESTION = 4; + } + CongestionLevel congestion_level = 6; + + enum OccupancyStatus { + EMPTY = 0; + MANY_SEATS_AVAILABLE = 1; + FEW_SEATS_AVAILABLE = 2; + STANDING_ROOM_ONLY = 3; + CRUSHED_STANDING_ROOM_ONLY = 4; + FULL = 5; + NOT_ACCEPTING_PASSENGERS = 6; + NO_DATA_AVAILABLE = 7; + NOT_BOARDABLE = 8; + } + OccupancyStatus occupancy_status = 9; + + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + uint32 occupancy_percentage = 10; + + // NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. + message CarriageDetails { + string id = 1; + string label = 2; + OccupancyStatus occupancy_status = 3; + int32 occupancy_percentage = 4; + uint32 carriage_sequence = 5; + } + + // NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. + repeated CarriageDetails multi_carriage_details = 11; +} + +// An alert, indicating some sort of incident in the public transit network. +message Alert { + repeated TimeRange active_period = 1; + repeated EntitySelector informed_entity = 5; + + enum Cause { + UNKNOWN_CAUSE = 0; + OTHER_CAUSE = 2; + TECHNICAL_PROBLEM = 3; + STRIKE = 4; + DEMONSTRATION = 5; + ACCIDENT = 6; + HOLIDAY = 7; + WEATHER = 8; + MAINTENANCE = 9; + CONSTRUCTION = 10; + POLICE_ACTIVITY = 11; + MEDICAL_EMERGENCY = 12; + } + Cause cause = 6; + + enum Effect { + NO_SERVICE = 0; + REDUCED_SERVICE = 2; + SIGNIFICANT_DELAYS = 3; + DETOUR = 4; + ADDITIONAL_SERVICE = 5; + MODIFIED_SERVICE = 6; + OTHER_EFFECT = 7; + UNKNOWN_EFFECT = 8; + STOP_MOVED = 9; + NO_EFFECT = 10; + ACCESSIBILITY_ISSUE = 11; + } + Effect effect = 7; + + TranslatedString url = 8; + TranslatedString header_text = 10; + TranslatedString description_text = 11; + TranslatedString tts_header_text = 12; + TranslatedString tts_description_text = 13; + + enum SeverityLevel { + UNKNOWN_SEVERITY = 0; + INFO = 2; + WARNING = 3; + SEVERE = 4; + } + SeverityLevel severity_level = 14; + + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + TranslatedImage image = 15; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + TranslatedString image_alternative_text = 16; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + TranslatedString cause_detail = 17; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + TranslatedString effect_detail = 18; +} + +// A time interval. +message TimeRange { + uint64 start = 1; + uint64 end = 2; +} + +// A position. +message Position { + float latitude = 1; + float longitude = 2; + float bearing = 3; + double odometer = 4; + float speed = 5; +} + +// A descriptor that identifies an instance of a GTFS trip. +message TripDescriptor { + string trip_id = 1; + string route_id = 5; + uint32 direction_id = 6; + string start_time = 2; + string start_date = 3; + + enum ScheduleRelationship { + SCHEDULED = 0; + ADDED = 1 [deprecated = true]; + UNSCHEDULED = 2; + CANCELED = 3; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + REPLACEMENT = 5; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + DUPLICATED = 6; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + DELETED = 7; + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + NEW = 8; + } + ScheduleRelationship schedule_relationship = 4; + + message ModifiedTripSelector { + string modifications_id = 1; + string affected_trip_id = 2; + string start_time = 3; + string start_date = 4; + } + + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + ModifiedTripSelector modified_trip = 7; +} + +// Identification information for the vehicle performing the trip. +message VehicleDescriptor { + string id = 1; + string label = 2; + string license_plate = 3; + + enum WheelchairAccessible { + NO_VALUE = 0; + UNKNOWN = 1; + WHEELCHAIR_ACCESSIBLE = 2; + WHEELCHAIR_INACCESSIBLE = 3; + } + WheelchairAccessible wheelchair_accessible = 4; +} + +// A selector for an entity in a GTFS feed. +message EntitySelector { + string agency_id = 1; + string route_id = 2; + int32 route_type = 3; + TripDescriptor trip = 4; + string stop_id = 5; + uint32 direction_id = 6; +} + +// An internationalized message containing per-language versions of a snippet of text or a URL. +message TranslatedString { + message Translation { + string text = 1; + string language = 2; + } + repeated Translation translation = 1; +} + +// An internationalized image containing per-language versions of a URL linking to an image. +// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. +message TranslatedImage { + message LocalizedImage { + string url = 1; + string media_type = 2; + string language = 3; + } + repeated LocalizedImage localized_image = 1; +} + +// Describes the physical path that a vehicle takes when it's not part of the (CSV) GTFS. +// NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. +message Shape { + string shape_id = 1; + string encoded_polyline = 2; +} + +// Describes a stop which is served by trips. +// NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. +message Stop { + enum WheelchairBoarding { + UNKNOWN = 0; + AVAILABLE = 1; + NOT_AVAILABLE = 2; + } + + string stop_id = 1; + TranslatedString stop_code = 2; + TranslatedString stop_name = 3; + TranslatedString tts_stop_name = 4; + TranslatedString stop_desc = 5; + float stop_lat = 6; + float stop_lon = 7; + string zone_id = 8; + TranslatedString stop_url = 9; + string parent_station = 11; + string stop_timezone = 12; + WheelchairBoarding wheelchair_boarding = 13; + string level_id = 14; + TranslatedString platform_code = 15; +} + +// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. +message TripModifications { + message Modification { + StopSelector start_stop_selector = 1; + StopSelector end_stop_selector = 2; + int32 propagated_modification_delay = 3; + repeated ReplacementStop replacement_stops = 4; + string service_alert_id = 5; + uint64 last_modified_time = 6; + } + + message SelectedTrips { + repeated string trip_ids = 1; + string shape_id = 2; + } + + repeated SelectedTrips selected_trips = 1; + repeated string start_times = 2; + repeated string service_dates = 3; + repeated Modification modifications = 4; +} + +// Select a stop by stop sequence or by stop_id. +// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. +message StopSelector { + uint32 stop_sequence = 1; + string stop_id = 2; +} + +// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. +message ReplacementStop { + int32 travel_time_to_stop = 1; + string stop_id = 2; +} diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..54ae624 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,17 @@ + + + + + tests + + + + + src + + + diff --git a/src/GPBMetadata/GtfsRealtime.php b/src/GPBMetadata/GtfsRealtime.php new file mode 100644 index 0000000000000000000000000000000000000000..4550199f36f7e8a82ccd88dfa655fcf6ce1632ef GIT binary patch literal 7986 zcmcIp&2Qtz6^~@ewnnxrbG^HYHYpS(X*O-5CfcM;cC$%niMENAC{?8G8Zbc66m1ig zMU|x7Zi>AYXbbdMpy;K!7CjaHD{|?zJ@nFR5B(SVdov^@OWKWspnF+sIB(v(uiyKa zPd*!6j@av!eP`(SR_OFAXHP5PrBfOCUg+80pmH`oKX?3!?Ol!Bf#cUIm1d`+b&QJA zRE^g_8hB&hb{x=-?0Xvd*#$P{R75^)|C^CEZeEGLu!5kn z51L*?!hXpr_%|A#4P3htgjR_E-f#oc9lD`w4csqqyT_GtYY;d%V1DoUcxZ>NH>?mr zXJ|Y3->!%=Y3~~&57IoYobG$x#lSi3l7JBIR2_znKePs?O((E@cNBVl7h4}byl}!q zEwpm~?T9TM=bl&Yi#tAiICsg%mCzqM)7&c+-wDV5@DaZ^9q=sqi{I?sPu=Jqa=)Lj z-Gj>SCmV_EE%vvEY-f?KrDEt?!@v#A*a%gZ<@X$?-*$q)x^Sd-*y^QY^&P*Is-*7c z>#x*iDQdL+fbXH*&M^8$K)#Jwc`h{4d92UwQ#NZl{gzyG2e)zlj#(l*PHtHBCaqtXf_%1AqG;~Wws+%j0rRX<>b8PX!# z*gI^s%%*I}x?&VxlCaWL_x6;Yq8X~(DyFJmrG-R7K#8%m+mEh~AMne*GjI?wP*3Xq zy7WHFhwvVAJc5Ti{5}gcY+%zN-y_x8+O>1(+5@LV7tPmSn-~8`Z0LG0Ec7RRmt`%4 zVOYv?io5d^GJU3f!KF2FN~_P?r_*QY4VDQ)Z&X_2+wROCr{k;i8I!nhS6<&ecWs2G zHw;SaoaXg;8j`U+y|wzsJY!Rm*I0(mi~O*%_=HJ3N*_!#MTXAT7ch-9HASVcBFScw zm&A4vzP!NCCbz4R$OdR4Gu`krGE_#|WLa3>ddjVkm6~je#4!PSBPic>f=KNz=0hw2 zLlH^&gl)#0m1_jXgbRghR@#8la4YU_E7C2N2i}331>ktf{VglqVTHiHbo%1~f`D(P z`>vFKx5f(b*^yMY*(O&`;QVat;2>^`O=*j*@n!fr4<6|eTeE!My|xCNalZb&#nuwX zCb|<6JZ8DRGqQX@UmOzOg#3_|6LQnD?eWMO+D}cw-EqKOwore6{yH-;Q|rW(IwzD& zc01M*0BRt-`4a9(F;%F4K7ZnKouj5l>h4XQBb}bI9j-<0d2?Rz={I5!IpdV0{5Q>{ z*qW1Nsl*=-ggi1 zrz!6%TH~acmdfl-qtod%RZTV&^H?5T)WdDv2#I3B$8 zCu+BgA1V5wb$Eus;aeB?c$Y&PjJ8oC+>IoJyq`$EjTP4>`6q6E)Je!06{DhIx#BhpmsI z+!o$$kzR!uKA`^OzC87X79;i(unM z9w3EgaDLJDh8L(okPyv*bL|YcMwf!6Mnc&lLON^?<8olL)M2w2_X^vY9EJ>IQ>As` zlo(gkkJ+88F$#6lCTzz#iWwx5K~T!`T5kzZZA6q!L0JB4ifzrT-Kd$6G6&Wf^dtOu zk+1@Qmf*dtuw?A4^fKE{#7rE9?6+CnXWR33My#q@qtjNkeN(2|u)vsZbSSLpcM65) zrmC4nPu6tRFpW+zU3~`OXUzEuD;;W2w9c_+HagnAq8n;QGh51$(!!ZLtk^r$G~%JR zJ00Vob%K+@nmC!V)-?BVF0q~v7gvDf+d59@DN|<_Gu3}W`LjyNv8>YW8Yf^@VmobF zJ27=dHgr=ylGT>H+aege%Wmx{$8#Ujs3auaz%}TCy-ufXb~M~@MfwgaH+qLUFwb1@ zJwpgfm31*IL4LG}rrc;KU4xG4%DS#V5k0-QN`ge_ICY;jQY{hfcH~}@Uva(qXU4Lk zrmeG03mx9IW5S_bkE(HMOzzDGvw=FPXCW}9kJ*+xJoo%7Bt?V(wHjGYwV>!!_;(#; zy^SUi4N%s$#(}`dLjBcwHvC$(25kadt~%(H?J%lKzVp283g0FDfUS)EK~zIm=QkVF z%%L`M`Z}O|cp?3Ws}G=ZE=nZ8mx()RoW=+ zvOAo@#2|y_0^HxY&WcN4`Xjc%Jtsod()QAnAG1y2MKP(gENS&0DV7zkh#*RkM?TaQ zAOL^`7^C#e246^1{25B)KvNrX%k1_#fP*%|o3T~h=&4VXVuoU|skA#97G%OM#PkMR zM?9-dG|7lzR5%BnmfDn0ifi=a81Mof#dTuWmQ~GAG+ApXMJiD?fMYo6u)&XF=wG(F zAa0-n!_tuopvu#&+L$ZRos_oH6Q$Wk^JOE6{B<5gLD8mxrq@L1OvC2HcPrki%Z0Z zbGRq%@ak37_9!iovgICSkH}^`Cm<1=zQuAA@I%h!#Uk(RGN4*eBLXjs9_C8n7{BwDqa13 zM%1`dE%{uHi$i>G96D6HiXs&=oWAP=NC~X4N&}3|nYwqT7EUHEImvilZzl@B59eWn zs_@AT7dLb*wkbv*)K=5rLX1nk{xmTKar(q0PAp{~>6lMPZmv@UC%8ld7Lr~xaMarI zv=Q;AFEcur>Iae@f$N0?&sBeuTCRnG2@w|5z?9SLydatGThfF8h^dA`4bKY2c~9xK zScEO_&`xwjRRTj@v4X797R@Iy2tKLeL{a3fdD?PRR4rVaHjA;@F5e? zq$6>F=`cwQF9Ij&-Lpx{MkdeK7gRVmeVsx&9u&MF_Nu>1vEn36M&(F@=AEKML7+yZ zSZ!Y8vxK#H0aWF8S$^s#pKwuaBb=V2((qzT>6^=3{Sswvyx-}Ie66yrfoF^70aN69 zQ5L@UqPuX~S}P{xKg*a(-&`TYq#{k+2M&rV(zV18Ls((@j=UMKK44ifS;eQMD^H>r zR`vP_;*mFaI&g=vVE@Um40W2*77;WbvK%)Nkwp#iGBsaJ#(R9a*mA`l$`7j7I7dz@ zJn5Toq*{+7`EnddOAy>dRCA=~X+^BSs|aR!=J~=K@)SXng&fAgf{1KG9rALlFdW4w z5={UfAd=Hk6+D@a5rPt*64kdkX^-8S0+%z-^81wgsB|sV-=23a9b!zO$!7r#px1St~Qu70j7in%7GY&UZSF7y2Fb)s>xEi`j-rfKO`iP zgra04sZ?oG>l5XeAd2Y){rDVlP2@I_&jOlFPli+h+;$~Wv*TX_#`!!e0EW}@ewfEV*k~KIQaoi69bpuI zUq|{TdzD7M)&(_h=5$6!QBRKs6pvZy6SnO;@B^E_f^kj(>L}`H7qlt8$yT~2)e1qR zO^Y6U$h!oFmzjjO)i7dA#-v9Bs-iOG2UKVZ8;19NOz}4c{ z&9BmTqo>?co)g^g^fZ1;{&zY*_1t{63VVd!gSV2G)OW-K?bLfNJO%H~3*K`1PVsE} Ij6GxQe>l`?djJ3c literal 0 HcmV?d00001 diff --git a/src/Google/Transit/Realtime/Alert.php b/src/Google/Transit/Realtime/Alert.php new file mode 100644 index 0000000..050e314 --- /dev/null +++ b/src/Google/Transit/Realtime/Alert.php @@ -0,0 +1,529 @@ +transit_realtime.Alert + */ +class Alert extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .transit_realtime.TimeRange active_period = 1; + */ + private $active_period; + /** + * Generated from protobuf field repeated .transit_realtime.EntitySelector informed_entity = 5; + */ + private $informed_entity; + /** + * Generated from protobuf field .transit_realtime.Alert.Cause cause = 6; + */ + protected $cause = 0; + /** + * Generated from protobuf field .transit_realtime.Alert.Effect effect = 7; + */ + protected $effect = 0; + /** + * Generated from protobuf field .transit_realtime.TranslatedString url = 8; + */ + protected $url = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString header_text = 10; + */ + protected $header_text = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString description_text = 11; + */ + protected $description_text = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_header_text = 12; + */ + protected $tts_header_text = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_description_text = 13; + */ + protected $tts_description_text = null; + /** + * Generated from protobuf field .transit_realtime.Alert.SeverityLevel severity_level = 14; + */ + protected $severity_level = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedImage image = 15; + */ + protected $image = null; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString image_alternative_text = 16; + */ + protected $image_alternative_text = null; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString cause_detail = 17; + */ + protected $cause_detail = null; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString effect_detail = 18; + */ + protected $effect_detail = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Transit\Realtime\TimeRange>|\Google\Protobuf\Internal\RepeatedField $active_period + * @type array<\Google\Transit\Realtime\EntitySelector>|\Google\Protobuf\Internal\RepeatedField $informed_entity + * @type int $cause + * @type int $effect + * @type \Google\Transit\Realtime\TranslatedString $url + * @type \Google\Transit\Realtime\TranslatedString $header_text + * @type \Google\Transit\Realtime\TranslatedString $description_text + * @type \Google\Transit\Realtime\TranslatedString $tts_header_text + * @type \Google\Transit\Realtime\TranslatedString $tts_description_text + * @type int $severity_level + * @type \Google\Transit\Realtime\TranslatedImage $image + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type \Google\Transit\Realtime\TranslatedString $image_alternative_text + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type \Google\Transit\Realtime\TranslatedString $cause_detail + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type \Google\Transit\Realtime\TranslatedString $effect_detail + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .transit_realtime.TimeRange active_period = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActivePeriod() + { + return $this->active_period; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TimeRange active_period = 1; + * @param array<\Google\Transit\Realtime\TimeRange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActivePeriod($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TimeRange::class); + $this->active_period = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .transit_realtime.EntitySelector informed_entity = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInformedEntity() + { + return $this->informed_entity; + } + + /** + * Generated from protobuf field repeated .transit_realtime.EntitySelector informed_entity = 5; + * @param array<\Google\Transit\Realtime\EntitySelector>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInformedEntity($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\EntitySelector::class); + $this->informed_entity = $arr; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Alert.Cause cause = 6; + * @return int + */ + public function getCause() + { + return $this->cause; + } + + /** + * Generated from protobuf field .transit_realtime.Alert.Cause cause = 6; + * @param int $var + * @return $this + */ + public function setCause($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\Alert\Cause::class); + $this->cause = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Alert.Effect effect = 7; + * @return int + */ + public function getEffect() + { + return $this->effect; + } + + /** + * Generated from protobuf field .transit_realtime.Alert.Effect effect = 7; + * @param int $var + * @return $this + */ + public function setEffect($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\Alert\Effect::class); + $this->effect = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString url = 8; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getUrl() + { + return $this->url; + } + + public function hasUrl() + { + return isset($this->url); + } + + public function clearUrl() + { + unset($this->url); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString url = 8; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->url = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString header_text = 10; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getHeaderText() + { + return $this->header_text; + } + + public function hasHeaderText() + { + return isset($this->header_text); + } + + public function clearHeaderText() + { + unset($this->header_text); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString header_text = 10; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setHeaderText($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->header_text = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString description_text = 11; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getDescriptionText() + { + return $this->description_text; + } + + public function hasDescriptionText() + { + return isset($this->description_text); + } + + public function clearDescriptionText() + { + unset($this->description_text); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString description_text = 11; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setDescriptionText($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->description_text = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_header_text = 12; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getTtsHeaderText() + { + return $this->tts_header_text; + } + + public function hasTtsHeaderText() + { + return isset($this->tts_header_text); + } + + public function clearTtsHeaderText() + { + unset($this->tts_header_text); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_header_text = 12; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setTtsHeaderText($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->tts_header_text = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_description_text = 13; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getTtsDescriptionText() + { + return $this->tts_description_text; + } + + public function hasTtsDescriptionText() + { + return isset($this->tts_description_text); + } + + public function clearTtsDescriptionText() + { + unset($this->tts_description_text); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_description_text = 13; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setTtsDescriptionText($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->tts_description_text = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Alert.SeverityLevel severity_level = 14; + * @return int + */ + public function getSeverityLevel() + { + return $this->severity_level; + } + + /** + * Generated from protobuf field .transit_realtime.Alert.SeverityLevel severity_level = 14; + * @param int $var + * @return $this + */ + public function setSeverityLevel($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\Alert\SeverityLevel::class); + $this->severity_level = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedImage image = 15; + * @return \Google\Transit\Realtime\TranslatedImage|null + */ + public function getImage() + { + return $this->image; + } + + public function hasImage() + { + return isset($this->image); + } + + public function clearImage() + { + unset($this->image); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedImage image = 15; + * @param \Google\Transit\Realtime\TranslatedImage $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedImage::class); + $this->image = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString image_alternative_text = 16; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getImageAlternativeText() + { + return $this->image_alternative_text; + } + + public function hasImageAlternativeText() + { + return isset($this->image_alternative_text); + } + + public function clearImageAlternativeText() + { + unset($this->image_alternative_text); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString image_alternative_text = 16; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setImageAlternativeText($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->image_alternative_text = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString cause_detail = 17; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getCauseDetail() + { + return $this->cause_detail; + } + + public function hasCauseDetail() + { + return isset($this->cause_detail); + } + + public function clearCauseDetail() + { + unset($this->cause_detail); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString cause_detail = 17; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setCauseDetail($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->cause_detail = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString effect_detail = 18; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getEffectDetail() + { + return $this->effect_detail; + } + + public function hasEffectDetail() + { + return isset($this->effect_detail); + } + + public function clearEffectDetail() + { + unset($this->effect_detail); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TranslatedString effect_detail = 18; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setEffectDetail($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->effect_detail = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/Alert/Cause.php b/src/Google/Transit/Realtime/Alert/Cause.php new file mode 100644 index 0000000..d118784 --- /dev/null +++ b/src/Google/Transit/Realtime/Alert/Cause.php @@ -0,0 +1,101 @@ +transit_realtime.Alert.Cause + */ +class Cause +{ + /** + * Generated from protobuf enum UNKNOWN_CAUSE = 0; + */ + const UNKNOWN_CAUSE = 0; + /** + * Generated from protobuf enum OTHER_CAUSE = 2; + */ + const OTHER_CAUSE = 2; + /** + * Generated from protobuf enum TECHNICAL_PROBLEM = 3; + */ + const TECHNICAL_PROBLEM = 3; + /** + * Generated from protobuf enum STRIKE = 4; + */ + const STRIKE = 4; + /** + * Generated from protobuf enum DEMONSTRATION = 5; + */ + const DEMONSTRATION = 5; + /** + * Generated from protobuf enum ACCIDENT = 6; + */ + const ACCIDENT = 6; + /** + * Generated from protobuf enum HOLIDAY = 7; + */ + const HOLIDAY = 7; + /** + * Generated from protobuf enum WEATHER = 8; + */ + const WEATHER = 8; + /** + * Generated from protobuf enum MAINTENANCE = 9; + */ + const MAINTENANCE = 9; + /** + * Generated from protobuf enum CONSTRUCTION = 10; + */ + const CONSTRUCTION = 10; + /** + * Generated from protobuf enum POLICE_ACTIVITY = 11; + */ + const POLICE_ACTIVITY = 11; + /** + * Generated from protobuf enum MEDICAL_EMERGENCY = 12; + */ + const MEDICAL_EMERGENCY = 12; + + private static $valueToName = [ + self::UNKNOWN_CAUSE => 'UNKNOWN_CAUSE', + self::OTHER_CAUSE => 'OTHER_CAUSE', + self::TECHNICAL_PROBLEM => 'TECHNICAL_PROBLEM', + self::STRIKE => 'STRIKE', + self::DEMONSTRATION => 'DEMONSTRATION', + self::ACCIDENT => 'ACCIDENT', + self::HOLIDAY => 'HOLIDAY', + self::WEATHER => 'WEATHER', + self::MAINTENANCE => 'MAINTENANCE', + self::CONSTRUCTION => 'CONSTRUCTION', + self::POLICE_ACTIVITY => 'POLICE_ACTIVITY', + self::MEDICAL_EMERGENCY => 'MEDICAL_EMERGENCY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Cause::class, \Google\Transit\Realtime\Alert_Cause::class); + diff --git a/src/Google/Transit/Realtime/Alert/Effect.php b/src/Google/Transit/Realtime/Alert/Effect.php new file mode 100644 index 0000000..e197b7d --- /dev/null +++ b/src/Google/Transit/Realtime/Alert/Effect.php @@ -0,0 +1,96 @@ +transit_realtime.Alert.Effect + */ +class Effect +{ + /** + * Generated from protobuf enum NO_SERVICE = 0; + */ + const NO_SERVICE = 0; + /** + * Generated from protobuf enum REDUCED_SERVICE = 2; + */ + const REDUCED_SERVICE = 2; + /** + * Generated from protobuf enum SIGNIFICANT_DELAYS = 3; + */ + const SIGNIFICANT_DELAYS = 3; + /** + * Generated from protobuf enum DETOUR = 4; + */ + const DETOUR = 4; + /** + * Generated from protobuf enum ADDITIONAL_SERVICE = 5; + */ + const ADDITIONAL_SERVICE = 5; + /** + * Generated from protobuf enum MODIFIED_SERVICE = 6; + */ + const MODIFIED_SERVICE = 6; + /** + * Generated from protobuf enum OTHER_EFFECT = 7; + */ + const OTHER_EFFECT = 7; + /** + * Generated from protobuf enum UNKNOWN_EFFECT = 8; + */ + const UNKNOWN_EFFECT = 8; + /** + * Generated from protobuf enum STOP_MOVED = 9; + */ + const STOP_MOVED = 9; + /** + * Generated from protobuf enum NO_EFFECT = 10; + */ + const NO_EFFECT = 10; + /** + * Generated from protobuf enum ACCESSIBILITY_ISSUE = 11; + */ + const ACCESSIBILITY_ISSUE = 11; + + private static $valueToName = [ + self::NO_SERVICE => 'NO_SERVICE', + self::REDUCED_SERVICE => 'REDUCED_SERVICE', + self::SIGNIFICANT_DELAYS => 'SIGNIFICANT_DELAYS', + self::DETOUR => 'DETOUR', + self::ADDITIONAL_SERVICE => 'ADDITIONAL_SERVICE', + self::MODIFIED_SERVICE => 'MODIFIED_SERVICE', + self::OTHER_EFFECT => 'OTHER_EFFECT', + self::UNKNOWN_EFFECT => 'UNKNOWN_EFFECT', + self::STOP_MOVED => 'STOP_MOVED', + self::NO_EFFECT => 'NO_EFFECT', + self::ACCESSIBILITY_ISSUE => 'ACCESSIBILITY_ISSUE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Effect::class, \Google\Transit\Realtime\Alert_Effect::class); + diff --git a/src/Google/Transit/Realtime/Alert/SeverityLevel.php b/src/Google/Transit/Realtime/Alert/SeverityLevel.php new file mode 100644 index 0000000..32a64d2 --- /dev/null +++ b/src/Google/Transit/Realtime/Alert/SeverityLevel.php @@ -0,0 +1,61 @@ +transit_realtime.Alert.SeverityLevel + */ +class SeverityLevel +{ + /** + * Generated from protobuf enum UNKNOWN_SEVERITY = 0; + */ + const UNKNOWN_SEVERITY = 0; + /** + * Generated from protobuf enum INFO = 2; + */ + const INFO = 2; + /** + * Generated from protobuf enum WARNING = 3; + */ + const WARNING = 3; + /** + * Generated from protobuf enum SEVERE = 4; + */ + const SEVERE = 4; + + private static $valueToName = [ + self::UNKNOWN_SEVERITY => 'UNKNOWN_SEVERITY', + self::INFO => 'INFO', + self::WARNING => 'WARNING', + self::SEVERE => 'SEVERE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SeverityLevel::class, \Google\Transit\Realtime\Alert_SeverityLevel::class); + diff --git a/src/Google/Transit/Realtime/Alert_Cause.php b/src/Google/Transit/Realtime/Alert_Cause.php new file mode 100644 index 0000000..1ce16a7 --- /dev/null +++ b/src/Google/Transit/Realtime/Alert_Cause.php @@ -0,0 +1,16 @@ +transit_realtime.EntitySelector + */ +class EntitySelector extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string agency_id = 1; + */ + protected $agency_id = ''; + /** + * Generated from protobuf field string route_id = 2; + */ + protected $route_id = ''; + /** + * Generated from protobuf field int32 route_type = 3; + */ + protected $route_type = 0; + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 4; + */ + protected $trip = null; + /** + * Generated from protobuf field string stop_id = 5; + */ + protected $stop_id = ''; + /** + * Generated from protobuf field uint32 direction_id = 6; + */ + protected $direction_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $agency_id + * @type string $route_id + * @type int $route_type + * @type \Google\Transit\Realtime\TripDescriptor $trip + * @type string $stop_id + * @type int $direction_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string agency_id = 1; + * @return string + */ + public function getAgencyId() + { + return $this->agency_id; + } + + /** + * Generated from protobuf field string agency_id = 1; + * @param string $var + * @return $this + */ + public function setAgencyId($var) + { + GPBUtil::checkString($var, True); + $this->agency_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string route_id = 2; + * @return string + */ + public function getRouteId() + { + return $this->route_id; + } + + /** + * Generated from protobuf field string route_id = 2; + * @param string $var + * @return $this + */ + public function setRouteId($var) + { + GPBUtil::checkString($var, True); + $this->route_id = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 route_type = 3; + * @return int + */ + public function getRouteType() + { + return $this->route_type; + } + + /** + * Generated from protobuf field int32 route_type = 3; + * @param int $var + * @return $this + */ + public function setRouteType($var) + { + GPBUtil::checkInt32($var); + $this->route_type = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 4; + * @return \Google\Transit\Realtime\TripDescriptor|null + */ + public function getTrip() + { + return $this->trip; + } + + public function hasTrip() + { + return isset($this->trip); + } + + public function clearTrip() + { + unset($this->trip); + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 4; + * @param \Google\Transit\Realtime\TripDescriptor $var + * @return $this + */ + public function setTrip($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor::class); + $this->trip = $var; + + return $this; + } + + /** + * Generated from protobuf field string stop_id = 5; + * @return string + */ + public function getStopId() + { + return $this->stop_id; + } + + /** + * Generated from protobuf field string stop_id = 5; + * @param string $var + * @return $this + */ + public function setStopId($var) + { + GPBUtil::checkString($var, True); + $this->stop_id = $var; + + return $this; + } + + /** + * Generated from protobuf field uint32 direction_id = 6; + * @return int + */ + public function getDirectionId() + { + return $this->direction_id; + } + + /** + * Generated from protobuf field uint32 direction_id = 6; + * @param int $var + * @return $this + */ + public function setDirectionId($var) + { + GPBUtil::checkUint32($var); + $this->direction_id = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/FeedEntity.php b/src/Google/Transit/Realtime/FeedEntity.php new file mode 100644 index 0000000..4dfc9b4 --- /dev/null +++ b/src/Google/Transit/Realtime/FeedEntity.php @@ -0,0 +1,316 @@ +transit_realtime.FeedEntity + */ +class FeedEntity extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * Generated from protobuf field bool is_deleted = 2; + */ + protected $is_deleted = false; + /** + * Generated from protobuf field .transit_realtime.TripUpdate trip_update = 3; + */ + protected $trip_update = null; + /** + * Generated from protobuf field .transit_realtime.VehiclePosition vehicle = 4; + */ + protected $vehicle = null; + /** + * Generated from protobuf field .transit_realtime.Alert alert = 5; + */ + protected $alert = null; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.Shape shape = 6; + */ + protected $shape = null; + /** + * Generated from protobuf field .transit_realtime.Stop stop = 7; + */ + protected $stop = null; + /** + * Generated from protobuf field .transit_realtime.TripModifications trip_modifications = 8; + */ + protected $trip_modifications = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * @type bool $is_deleted + * @type \Google\Transit\Realtime\TripUpdate $trip_update + * @type \Google\Transit\Realtime\VehiclePosition $vehicle + * @type \Google\Transit\Realtime\Alert $alert + * @type \Google\Transit\Realtime\Shape $shape + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type \Google\Transit\Realtime\Stop $stop + * @type \Google\Transit\Realtime\TripModifications $trip_modifications + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Generated from protobuf field bool is_deleted = 2; + * @return bool + */ + public function getIsDeleted() + { + return $this->is_deleted; + } + + /** + * Generated from protobuf field bool is_deleted = 2; + * @param bool $var + * @return $this + */ + public function setIsDeleted($var) + { + GPBUtil::checkBool($var); + $this->is_deleted = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate trip_update = 3; + * @return \Google\Transit\Realtime\TripUpdate|null + */ + public function getTripUpdate() + { + return $this->trip_update; + } + + public function hasTripUpdate() + { + return isset($this->trip_update); + } + + public function clearTripUpdate() + { + unset($this->trip_update); + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate trip_update = 3; + * @param \Google\Transit\Realtime\TripUpdate $var + * @return $this + */ + public function setTripUpdate($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate::class); + $this->trip_update = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition vehicle = 4; + * @return \Google\Transit\Realtime\VehiclePosition|null + */ + public function getVehicle() + { + return $this->vehicle; + } + + public function hasVehicle() + { + return isset($this->vehicle); + } + + public function clearVehicle() + { + unset($this->vehicle); + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition vehicle = 4; + * @param \Google\Transit\Realtime\VehiclePosition $var + * @return $this + */ + public function setVehicle($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\VehiclePosition::class); + $this->vehicle = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Alert alert = 5; + * @return \Google\Transit\Realtime\Alert|null + */ + public function getAlert() + { + return $this->alert; + } + + public function hasAlert() + { + return isset($this->alert); + } + + public function clearAlert() + { + unset($this->alert); + } + + /** + * Generated from protobuf field .transit_realtime.Alert alert = 5; + * @param \Google\Transit\Realtime\Alert $var + * @return $this + */ + public function setAlert($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\Alert::class); + $this->alert = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.Shape shape = 6; + * @return \Google\Transit\Realtime\Shape|null + */ + public function getShape() + { + return $this->shape; + } + + public function hasShape() + { + return isset($this->shape); + } + + public function clearShape() + { + unset($this->shape); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.Shape shape = 6; + * @param \Google\Transit\Realtime\Shape $var + * @return $this + */ + public function setShape($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\Shape::class); + $this->shape = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Stop stop = 7; + * @return \Google\Transit\Realtime\Stop|null + */ + public function getStop() + { + return $this->stop; + } + + public function hasStop() + { + return isset($this->stop); + } + + public function clearStop() + { + unset($this->stop); + } + + /** + * Generated from protobuf field .transit_realtime.Stop stop = 7; + * @param \Google\Transit\Realtime\Stop $var + * @return $this + */ + public function setStop($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\Stop::class); + $this->stop = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripModifications trip_modifications = 8; + * @return \Google\Transit\Realtime\TripModifications|null + */ + public function getTripModifications() + { + return $this->trip_modifications; + } + + public function hasTripModifications() + { + return isset($this->trip_modifications); + } + + public function clearTripModifications() + { + unset($this->trip_modifications); + } + + /** + * Generated from protobuf field .transit_realtime.TripModifications trip_modifications = 8; + * @param \Google\Transit\Realtime\TripModifications $var + * @return $this + */ + public function setTripModifications($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripModifications::class); + $this->trip_modifications = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/FeedHeader.php b/src/Google/Transit/Realtime/FeedHeader.php new file mode 100644 index 0000000..21de23c --- /dev/null +++ b/src/Google/Transit/Realtime/FeedHeader.php @@ -0,0 +1,141 @@ +transit_realtime.FeedHeader + */ +class FeedHeader extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string gtfs_realtime_version = 1; + */ + protected $gtfs_realtime_version = ''; + /** + * Generated from protobuf field .transit_realtime.FeedHeader.Incrementality incrementality = 2; + */ + protected $incrementality = 0; + /** + * Generated from protobuf field uint64 timestamp = 3; + */ + protected $timestamp = 0; + /** + * Generated from protobuf field string feed_version = 4; + */ + protected $feed_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gtfs_realtime_version + * @type int $incrementality + * @type int|string $timestamp + * @type string $feed_version + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string gtfs_realtime_version = 1; + * @return string + */ + public function getGtfsRealtimeVersion() + { + return $this->gtfs_realtime_version; + } + + /** + * Generated from protobuf field string gtfs_realtime_version = 1; + * @param string $var + * @return $this + */ + public function setGtfsRealtimeVersion($var) + { + GPBUtil::checkString($var, True); + $this->gtfs_realtime_version = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.FeedHeader.Incrementality incrementality = 2; + * @return int + */ + public function getIncrementality() + { + return $this->incrementality; + } + + /** + * Generated from protobuf field .transit_realtime.FeedHeader.Incrementality incrementality = 2; + * @param int $var + * @return $this + */ + public function setIncrementality($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\FeedHeader\Incrementality::class); + $this->incrementality = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 timestamp = 3; + * @return int|string + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * Generated from protobuf field uint64 timestamp = 3; + * @param int|string $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkUint64($var); + $this->timestamp = $var; + + return $this; + } + + /** + * Generated from protobuf field string feed_version = 4; + * @return string + */ + public function getFeedVersion() + { + return $this->feed_version; + } + + /** + * Generated from protobuf field string feed_version = 4; + * @param string $var + * @return $this + */ + public function setFeedVersion($var) + { + GPBUtil::checkString($var, True); + $this->feed_version = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/FeedHeader/Incrementality.php b/src/Google/Transit/Realtime/FeedHeader/Incrementality.php new file mode 100644 index 0000000..21b5c1b --- /dev/null +++ b/src/Google/Transit/Realtime/FeedHeader/Incrementality.php @@ -0,0 +1,51 @@ +transit_realtime.FeedHeader.Incrementality + */ +class Incrementality +{ + /** + * Generated from protobuf enum FULL_DATASET = 0; + */ + const FULL_DATASET = 0; + /** + * Generated from protobuf enum DIFFERENTIAL = 1; + */ + const DIFFERENTIAL = 1; + + private static $valueToName = [ + self::FULL_DATASET => 'FULL_DATASET', + self::DIFFERENTIAL => 'DIFFERENTIAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Incrementality::class, \Google\Transit\Realtime\FeedHeader_Incrementality::class); + diff --git a/src/Google/Transit/Realtime/FeedHeader_Incrementality.php b/src/Google/Transit/Realtime/FeedHeader_Incrementality.php new file mode 100644 index 0000000..ebe53e5 --- /dev/null +++ b/src/Google/Transit/Realtime/FeedHeader_Incrementality.php @@ -0,0 +1,16 @@ +transit_realtime.FeedMessage + */ +class FeedMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field .transit_realtime.FeedHeader header = 1; + */ + protected $header = null; + /** + * Generated from protobuf field repeated .transit_realtime.FeedEntity entity = 2; + */ + private $entity; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Transit\Realtime\FeedHeader $header + * @type array<\Google\Transit\Realtime\FeedEntity>|\Google\Protobuf\Internal\RepeatedField $entity + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .transit_realtime.FeedHeader header = 1; + * @return \Google\Transit\Realtime\FeedHeader|null + */ + public function getHeader() + { + return $this->header; + } + + public function hasHeader() + { + return isset($this->header); + } + + public function clearHeader() + { + unset($this->header); + } + + /** + * Generated from protobuf field .transit_realtime.FeedHeader header = 1; + * @param \Google\Transit\Realtime\FeedHeader $var + * @return $this + */ + public function setHeader($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\FeedHeader::class); + $this->header = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .transit_realtime.FeedEntity entity = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntity() + { + return $this->entity; + } + + /** + * Generated from protobuf field repeated .transit_realtime.FeedEntity entity = 2; + * @param array<\Google\Transit\Realtime\FeedEntity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntity($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\FeedEntity::class); + $this->entity = $arr; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/Position.php b/src/Google/Transit/Realtime/Position.php new file mode 100644 index 0000000..356fdc8 --- /dev/null +++ b/src/Google/Transit/Realtime/Position.php @@ -0,0 +1,168 @@ +transit_realtime.Position + */ +class Position extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field float latitude = 1; + */ + protected $latitude = 0.0; + /** + * Generated from protobuf field float longitude = 2; + */ + protected $longitude = 0.0; + /** + * Generated from protobuf field float bearing = 3; + */ + protected $bearing = 0.0; + /** + * Generated from protobuf field double odometer = 4; + */ + protected $odometer = 0.0; + /** + * Generated from protobuf field float speed = 5; + */ + protected $speed = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $latitude + * @type float $longitude + * @type float $bearing + * @type float $odometer + * @type float $speed + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field float latitude = 1; + * @return float + */ + public function getLatitude() + { + return $this->latitude; + } + + /** + * Generated from protobuf field float latitude = 1; + * @param float $var + * @return $this + */ + public function setLatitude($var) + { + GPBUtil::checkFloat($var); + $this->latitude = $var; + + return $this; + } + + /** + * Generated from protobuf field float longitude = 2; + * @return float + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * Generated from protobuf field float longitude = 2; + * @param float $var + * @return $this + */ + public function setLongitude($var) + { + GPBUtil::checkFloat($var); + $this->longitude = $var; + + return $this; + } + + /** + * Generated from protobuf field float bearing = 3; + * @return float + */ + public function getBearing() + { + return $this->bearing; + } + + /** + * Generated from protobuf field float bearing = 3; + * @param float $var + * @return $this + */ + public function setBearing($var) + { + GPBUtil::checkFloat($var); + $this->bearing = $var; + + return $this; + } + + /** + * Generated from protobuf field double odometer = 4; + * @return float + */ + public function getOdometer() + { + return $this->odometer; + } + + /** + * Generated from protobuf field double odometer = 4; + * @param float $var + * @return $this + */ + public function setOdometer($var) + { + GPBUtil::checkDouble($var); + $this->odometer = $var; + + return $this; + } + + /** + * Generated from protobuf field float speed = 5; + * @return float + */ + public function getSpeed() + { + return $this->speed; + } + + /** + * Generated from protobuf field float speed = 5; + * @param float $var + * @return $this + */ + public function setSpeed($var) + { + GPBUtil::checkFloat($var); + $this->speed = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/ReplacementStop.php b/src/Google/Transit/Realtime/ReplacementStop.php new file mode 100644 index 0000000..3fb7d32 --- /dev/null +++ b/src/Google/Transit/Realtime/ReplacementStop.php @@ -0,0 +1,87 @@ +transit_realtime.ReplacementStop + */ +class ReplacementStop extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 travel_time_to_stop = 1; + */ + protected $travel_time_to_stop = 0; + /** + * Generated from protobuf field string stop_id = 2; + */ + protected $stop_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $travel_time_to_stop + * @type string $stop_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 travel_time_to_stop = 1; + * @return int + */ + public function getTravelTimeToStop() + { + return $this->travel_time_to_stop; + } + + /** + * Generated from protobuf field int32 travel_time_to_stop = 1; + * @param int $var + * @return $this + */ + public function setTravelTimeToStop($var) + { + GPBUtil::checkInt32($var); + $this->travel_time_to_stop = $var; + + return $this; + } + + /** + * Generated from protobuf field string stop_id = 2; + * @return string + */ + public function getStopId() + { + return $this->stop_id; + } + + /** + * Generated from protobuf field string stop_id = 2; + * @param string $var + * @return $this + */ + public function setStopId($var) + { + GPBUtil::checkString($var, True); + $this->stop_id = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/Shape.php b/src/Google/Transit/Realtime/Shape.php new file mode 100644 index 0000000..da5feaf --- /dev/null +++ b/src/Google/Transit/Realtime/Shape.php @@ -0,0 +1,88 @@ +transit_realtime.Shape + */ +class Shape extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string shape_id = 1; + */ + protected $shape_id = ''; + /** + * Generated from protobuf field string encoded_polyline = 2; + */ + protected $encoded_polyline = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $shape_id + * @type string $encoded_polyline + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string shape_id = 1; + * @return string + */ + public function getShapeId() + { + return $this->shape_id; + } + + /** + * Generated from protobuf field string shape_id = 1; + * @param string $var + * @return $this + */ + public function setShapeId($var) + { + GPBUtil::checkString($var, True); + $this->shape_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string encoded_polyline = 2; + * @return string + */ + public function getEncodedPolyline() + { + return $this->encoded_polyline; + } + + /** + * Generated from protobuf field string encoded_polyline = 2; + * @param string $var + * @return $this + */ + public function setEncodedPolyline($var) + { + GPBUtil::checkString($var, True); + $this->encoded_polyline = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/Stop.php b/src/Google/Transit/Realtime/Stop.php new file mode 100644 index 0000000..2023003 --- /dev/null +++ b/src/Google/Transit/Realtime/Stop.php @@ -0,0 +1,472 @@ +transit_realtime.Stop + */ +class Stop extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string stop_id = 1; + */ + protected $stop_id = ''; + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_code = 2; + */ + protected $stop_code = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_name = 3; + */ + protected $stop_name = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_stop_name = 4; + */ + protected $tts_stop_name = null; + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_desc = 5; + */ + protected $stop_desc = null; + /** + * Generated from protobuf field float stop_lat = 6; + */ + protected $stop_lat = 0.0; + /** + * Generated from protobuf field float stop_lon = 7; + */ + protected $stop_lon = 0.0; + /** + * Generated from protobuf field string zone_id = 8; + */ + protected $zone_id = ''; + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_url = 9; + */ + protected $stop_url = null; + /** + * Generated from protobuf field string parent_station = 11; + */ + protected $parent_station = ''; + /** + * Generated from protobuf field string stop_timezone = 12; + */ + protected $stop_timezone = ''; + /** + * Generated from protobuf field .transit_realtime.Stop.WheelchairBoarding wheelchair_boarding = 13; + */ + protected $wheelchair_boarding = 0; + /** + * Generated from protobuf field string level_id = 14; + */ + protected $level_id = ''; + /** + * Generated from protobuf field .transit_realtime.TranslatedString platform_code = 15; + */ + protected $platform_code = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $stop_id + * @type \Google\Transit\Realtime\TranslatedString $stop_code + * @type \Google\Transit\Realtime\TranslatedString $stop_name + * @type \Google\Transit\Realtime\TranslatedString $tts_stop_name + * @type \Google\Transit\Realtime\TranslatedString $stop_desc + * @type float $stop_lat + * @type float $stop_lon + * @type string $zone_id + * @type \Google\Transit\Realtime\TranslatedString $stop_url + * @type string $parent_station + * @type string $stop_timezone + * @type int $wheelchair_boarding + * @type string $level_id + * @type \Google\Transit\Realtime\TranslatedString $platform_code + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string stop_id = 1; + * @return string + */ + public function getStopId() + { + return $this->stop_id; + } + + /** + * Generated from protobuf field string stop_id = 1; + * @param string $var + * @return $this + */ + public function setStopId($var) + { + GPBUtil::checkString($var, True); + $this->stop_id = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_code = 2; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getStopCode() + { + return $this->stop_code; + } + + public function hasStopCode() + { + return isset($this->stop_code); + } + + public function clearStopCode() + { + unset($this->stop_code); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_code = 2; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setStopCode($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->stop_code = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_name = 3; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getStopName() + { + return $this->stop_name; + } + + public function hasStopName() + { + return isset($this->stop_name); + } + + public function clearStopName() + { + unset($this->stop_name); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_name = 3; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setStopName($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->stop_name = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_stop_name = 4; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getTtsStopName() + { + return $this->tts_stop_name; + } + + public function hasTtsStopName() + { + return isset($this->tts_stop_name); + } + + public function clearTtsStopName() + { + unset($this->tts_stop_name); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString tts_stop_name = 4; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setTtsStopName($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->tts_stop_name = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_desc = 5; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getStopDesc() + { + return $this->stop_desc; + } + + public function hasStopDesc() + { + return isset($this->stop_desc); + } + + public function clearStopDesc() + { + unset($this->stop_desc); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_desc = 5; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setStopDesc($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->stop_desc = $var; + + return $this; + } + + /** + * Generated from protobuf field float stop_lat = 6; + * @return float + */ + public function getStopLat() + { + return $this->stop_lat; + } + + /** + * Generated from protobuf field float stop_lat = 6; + * @param float $var + * @return $this + */ + public function setStopLat($var) + { + GPBUtil::checkFloat($var); + $this->stop_lat = $var; + + return $this; + } + + /** + * Generated from protobuf field float stop_lon = 7; + * @return float + */ + public function getStopLon() + { + return $this->stop_lon; + } + + /** + * Generated from protobuf field float stop_lon = 7; + * @param float $var + * @return $this + */ + public function setStopLon($var) + { + GPBUtil::checkFloat($var); + $this->stop_lon = $var; + + return $this; + } + + /** + * Generated from protobuf field string zone_id = 8; + * @return string + */ + public function getZoneId() + { + return $this->zone_id; + } + + /** + * Generated from protobuf field string zone_id = 8; + * @param string $var + * @return $this + */ + public function setZoneId($var) + { + GPBUtil::checkString($var, True); + $this->zone_id = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_url = 9; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getStopUrl() + { + return $this->stop_url; + } + + public function hasStopUrl() + { + return isset($this->stop_url); + } + + public function clearStopUrl() + { + unset($this->stop_url); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString stop_url = 9; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setStopUrl($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->stop_url = $var; + + return $this; + } + + /** + * Generated from protobuf field string parent_station = 11; + * @return string + */ + public function getParentStation() + { + return $this->parent_station; + } + + /** + * Generated from protobuf field string parent_station = 11; + * @param string $var + * @return $this + */ + public function setParentStation($var) + { + GPBUtil::checkString($var, True); + $this->parent_station = $var; + + return $this; + } + + /** + * Generated from protobuf field string stop_timezone = 12; + * @return string + */ + public function getStopTimezone() + { + return $this->stop_timezone; + } + + /** + * Generated from protobuf field string stop_timezone = 12; + * @param string $var + * @return $this + */ + public function setStopTimezone($var) + { + GPBUtil::checkString($var, True); + $this->stop_timezone = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Stop.WheelchairBoarding wheelchair_boarding = 13; + * @return int + */ + public function getWheelchairBoarding() + { + return $this->wheelchair_boarding; + } + + /** + * Generated from protobuf field .transit_realtime.Stop.WheelchairBoarding wheelchair_boarding = 13; + * @param int $var + * @return $this + */ + public function setWheelchairBoarding($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\Stop\WheelchairBoarding::class); + $this->wheelchair_boarding = $var; + + return $this; + } + + /** + * Generated from protobuf field string level_id = 14; + * @return string + */ + public function getLevelId() + { + return $this->level_id; + } + + /** + * Generated from protobuf field string level_id = 14; + * @param string $var + * @return $this + */ + public function setLevelId($var) + { + GPBUtil::checkString($var, True); + $this->level_id = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString platform_code = 15; + * @return \Google\Transit\Realtime\TranslatedString|null + */ + public function getPlatformCode() + { + return $this->platform_code; + } + + public function hasPlatformCode() + { + return isset($this->platform_code); + } + + public function clearPlatformCode() + { + unset($this->platform_code); + } + + /** + * Generated from protobuf field .transit_realtime.TranslatedString platform_code = 15; + * @param \Google\Transit\Realtime\TranslatedString $var + * @return $this + */ + public function setPlatformCode($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); + $this->platform_code = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php b/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php new file mode 100644 index 0000000..20b1cc2 --- /dev/null +++ b/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php @@ -0,0 +1,56 @@ +transit_realtime.Stop.WheelchairBoarding + */ +class WheelchairBoarding +{ + /** + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Generated from protobuf enum AVAILABLE = 1; + */ + const AVAILABLE = 1; + /** + * Generated from protobuf enum NOT_AVAILABLE = 2; + */ + const NOT_AVAILABLE = 2; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::AVAILABLE => 'AVAILABLE', + self::NOT_AVAILABLE => 'NOT_AVAILABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WheelchairBoarding::class, \Google\Transit\Realtime\Stop_WheelchairBoarding::class); + diff --git a/src/Google/Transit/Realtime/StopSelector.php b/src/Google/Transit/Realtime/StopSelector.php new file mode 100644 index 0000000..64a7b37 --- /dev/null +++ b/src/Google/Transit/Realtime/StopSelector.php @@ -0,0 +1,88 @@ +transit_realtime.StopSelector + */ +class StopSelector extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field uint32 stop_sequence = 1; + */ + protected $stop_sequence = 0; + /** + * Generated from protobuf field string stop_id = 2; + */ + protected $stop_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $stop_sequence + * @type string $stop_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field uint32 stop_sequence = 1; + * @return int + */ + public function getStopSequence() + { + return $this->stop_sequence; + } + + /** + * Generated from protobuf field uint32 stop_sequence = 1; + * @param int $var + * @return $this + */ + public function setStopSequence($var) + { + GPBUtil::checkUint32($var); + $this->stop_sequence = $var; + + return $this; + } + + /** + * Generated from protobuf field string stop_id = 2; + * @return string + */ + public function getStopId() + { + return $this->stop_id; + } + + /** + * Generated from protobuf field string stop_id = 2; + * @param string $var + * @return $this + */ + public function setStopId($var) + { + GPBUtil::checkString($var, True); + $this->stop_id = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/Stop_WheelchairBoarding.php b/src/Google/Transit/Realtime/Stop_WheelchairBoarding.php new file mode 100644 index 0000000..87342e5 --- /dev/null +++ b/src/Google/Transit/Realtime/Stop_WheelchairBoarding.php @@ -0,0 +1,16 @@ +transit_realtime.TimeRange + */ +class TimeRange extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field uint64 start = 1; + */ + protected $start = 0; + /** + * Generated from protobuf field uint64 end = 2; + */ + protected $end = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $start + * @type int|string $end + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field uint64 start = 1; + * @return int|string + */ + public function getStart() + { + return $this->start; + } + + /** + * Generated from protobuf field uint64 start = 1; + * @param int|string $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkUint64($var); + $this->start = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 end = 2; + * @return int|string + */ + public function getEnd() + { + return $this->end; + } + + /** + * Generated from protobuf field uint64 end = 2; + * @param int|string $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkUint64($var); + $this->end = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/TranslatedImage.php b/src/Google/Transit/Realtime/TranslatedImage.php new file mode 100644 index 0000000..8c086a3 --- /dev/null +++ b/src/Google/Transit/Realtime/TranslatedImage.php @@ -0,0 +1,61 @@ +transit_realtime.TranslatedImage + */ +class TranslatedImage extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .transit_realtime.TranslatedImage.LocalizedImage localized_image = 1; + */ + private $localized_image; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Transit\Realtime\TranslatedImage\LocalizedImage>|\Google\Protobuf\Internal\RepeatedField $localized_image + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .transit_realtime.TranslatedImage.LocalizedImage localized_image = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocalizedImage() + { + return $this->localized_image; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TranslatedImage.LocalizedImage localized_image = 1; + * @param array<\Google\Transit\Realtime\TranslatedImage\LocalizedImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocalizedImage($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TranslatedImage\LocalizedImage::class); + $this->localized_image = $arr; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php b/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php new file mode 100644 index 0000000..9820a9e --- /dev/null +++ b/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php @@ -0,0 +1,115 @@ +transit_realtime.TranslatedImage.LocalizedImage + */ +class LocalizedImage extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * Generated from protobuf field string media_type = 2; + */ + protected $media_type = ''; + /** + * Generated from protobuf field string language = 3; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * @type string $media_type + * @type string $language + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Generated from protobuf field string media_type = 2; + * @return string + */ + public function getMediaType() + { + return $this->media_type; + } + + /** + * Generated from protobuf field string media_type = 2; + * @param string $var + * @return $this + */ + public function setMediaType($var) + { + GPBUtil::checkString($var, True); + $this->media_type = $var; + + return $this; + } + + /** + * Generated from protobuf field string language = 3; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Generated from protobuf field string language = 3; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LocalizedImage::class, \Google\Transit\Realtime\TranslatedImage_LocalizedImage::class); + diff --git a/src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php b/src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php new file mode 100644 index 0000000..9349c98 --- /dev/null +++ b/src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php @@ -0,0 +1,16 @@ +transit_realtime.TranslatedString + */ +class TranslatedString extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .transit_realtime.TranslatedString.Translation translation = 1; + */ + private $translation; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Transit\Realtime\TranslatedString\Translation>|\Google\Protobuf\Internal\RepeatedField $translation + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .transit_realtime.TranslatedString.Translation translation = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTranslation() + { + return $this->translation; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TranslatedString.Translation translation = 1; + * @param array<\Google\Transit\Realtime\TranslatedString\Translation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTranslation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TranslatedString\Translation::class); + $this->translation = $arr; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/TranslatedString/Translation.php b/src/Google/Transit/Realtime/TranslatedString/Translation.php new file mode 100644 index 0000000..1c0b1a6 --- /dev/null +++ b/src/Google/Transit/Realtime/TranslatedString/Translation.php @@ -0,0 +1,88 @@ +transit_realtime.TranslatedString.Translation + */ +class Translation extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + /** + * Generated from protobuf field string language = 2; + */ + protected $language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * @type string $language + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Generated from protobuf field string language = 2; + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Generated from protobuf field string language = 2; + * @param string $var + * @return $this + */ + public function setLanguage($var) + { + GPBUtil::checkString($var, True); + $this->language = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Translation::class, \Google\Transit\Realtime\TranslatedString_Translation::class); + diff --git a/src/Google/Transit/Realtime/TranslatedString_Translation.php b/src/Google/Transit/Realtime/TranslatedString_Translation.php new file mode 100644 index 0000000..af10df6 --- /dev/null +++ b/src/Google/Transit/Realtime/TranslatedString_Translation.php @@ -0,0 +1,16 @@ +transit_realtime.TripDescriptor + */ +class TripDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string trip_id = 1; + */ + protected $trip_id = ''; + /** + * Generated from protobuf field string route_id = 5; + */ + protected $route_id = ''; + /** + * Generated from protobuf field uint32 direction_id = 6; + */ + protected $direction_id = 0; + /** + * Generated from protobuf field string start_time = 2; + */ + protected $start_time = ''; + /** + * Generated from protobuf field string start_date = 3; + */ + protected $start_date = ''; + /** + * Generated from protobuf field .transit_realtime.TripDescriptor.ScheduleRelationship schedule_relationship = 4; + */ + protected $schedule_relationship = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripDescriptor.ModifiedTripSelector modified_trip = 7; + */ + protected $modified_trip = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $trip_id + * @type string $route_id + * @type int $direction_id + * @type string $start_time + * @type string $start_date + * @type int $schedule_relationship + * @type \Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector $modified_trip + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string trip_id = 1; + * @return string + */ + public function getTripId() + { + return $this->trip_id; + } + + /** + * Generated from protobuf field string trip_id = 1; + * @param string $var + * @return $this + */ + public function setTripId($var) + { + GPBUtil::checkString($var, True); + $this->trip_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string route_id = 5; + * @return string + */ + public function getRouteId() + { + return $this->route_id; + } + + /** + * Generated from protobuf field string route_id = 5; + * @param string $var + * @return $this + */ + public function setRouteId($var) + { + GPBUtil::checkString($var, True); + $this->route_id = $var; + + return $this; + } + + /** + * Generated from protobuf field uint32 direction_id = 6; + * @return int + */ + public function getDirectionId() + { + return $this->direction_id; + } + + /** + * Generated from protobuf field uint32 direction_id = 6; + * @param int $var + * @return $this + */ + public function setDirectionId($var) + { + GPBUtil::checkUint32($var); + $this->direction_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string start_time = 2; + * @return string + */ + public function getStartTime() + { + return $this->start_time; + } + + /** + * Generated from protobuf field string start_time = 2; + * @param string $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkString($var, True); + $this->start_time = $var; + + return $this; + } + + /** + * Generated from protobuf field string start_date = 3; + * @return string + */ + public function getStartDate() + { + return $this->start_date; + } + + /** + * Generated from protobuf field string start_date = 3; + * @param string $var + * @return $this + */ + public function setStartDate($var) + { + GPBUtil::checkString($var, True); + $this->start_date = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor.ScheduleRelationship schedule_relationship = 4; + * @return int + */ + public function getScheduleRelationship() + { + return $this->schedule_relationship; + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor.ScheduleRelationship schedule_relationship = 4; + * @param int $var + * @return $this + */ + public function setScheduleRelationship($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripDescriptor\ScheduleRelationship::class); + $this->schedule_relationship = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripDescriptor.ModifiedTripSelector modified_trip = 7; + * @return \Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector|null + */ + public function getModifiedTrip() + { + return $this->modified_trip; + } + + public function hasModifiedTrip() + { + return isset($this->modified_trip); + } + + public function clearModifiedTrip() + { + unset($this->modified_trip); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripDescriptor.ModifiedTripSelector modified_trip = 7; + * @param \Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector $var + * @return $this + */ + public function setModifiedTrip($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector::class); + $this->modified_trip = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php b/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php new file mode 100644 index 0000000..57cb844 --- /dev/null +++ b/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php @@ -0,0 +1,142 @@ +transit_realtime.TripDescriptor.ModifiedTripSelector + */ +class ModifiedTripSelector extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string modifications_id = 1; + */ + protected $modifications_id = ''; + /** + * Generated from protobuf field string affected_trip_id = 2; + */ + protected $affected_trip_id = ''; + /** + * Generated from protobuf field string start_time = 3; + */ + protected $start_time = ''; + /** + * Generated from protobuf field string start_date = 4; + */ + protected $start_date = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $modifications_id + * @type string $affected_trip_id + * @type string $start_time + * @type string $start_date + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string modifications_id = 1; + * @return string + */ + public function getModificationsId() + { + return $this->modifications_id; + } + + /** + * Generated from protobuf field string modifications_id = 1; + * @param string $var + * @return $this + */ + public function setModificationsId($var) + { + GPBUtil::checkString($var, True); + $this->modifications_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string affected_trip_id = 2; + * @return string + */ + public function getAffectedTripId() + { + return $this->affected_trip_id; + } + + /** + * Generated from protobuf field string affected_trip_id = 2; + * @param string $var + * @return $this + */ + public function setAffectedTripId($var) + { + GPBUtil::checkString($var, True); + $this->affected_trip_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string start_time = 3; + * @return string + */ + public function getStartTime() + { + return $this->start_time; + } + + /** + * Generated from protobuf field string start_time = 3; + * @param string $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkString($var, True); + $this->start_time = $var; + + return $this; + } + + /** + * Generated from protobuf field string start_date = 4; + * @return string + */ + public function getStartDate() + { + return $this->start_date; + } + + /** + * Generated from protobuf field string start_date = 4; + * @param string $var + * @return $this + */ + public function setStartDate($var) + { + GPBUtil::checkString($var, True); + $this->start_date = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ModifiedTripSelector::class, \Google\Transit\Realtime\TripDescriptor_ModifiedTripSelector::class); + diff --git a/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php b/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php new file mode 100644 index 0000000..b575f45 --- /dev/null +++ b/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php @@ -0,0 +1,93 @@ +transit_realtime.TripDescriptor.ScheduleRelationship + */ +class ScheduleRelationship +{ + /** + * Generated from protobuf enum SCHEDULED = 0; + */ + const SCHEDULED = 0; + /** + * Generated from protobuf enum ADDED = 1 [deprecated = true]; + */ + const ADDED = 1; + /** + * Generated from protobuf enum UNSCHEDULED = 2; + */ + const UNSCHEDULED = 2; + /** + * Generated from protobuf enum CANCELED = 3; + */ + const CANCELED = 3; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf enum REPLACEMENT = 5; + */ + const REPLACEMENT = 5; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf enum DUPLICATED = 6; + */ + const DUPLICATED = 6; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf enum DELETED = 7; + */ + const DELETED = 7; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf enum NEW = 8; + */ + const PBNEW = 8; + + private static $valueToName = [ + self::SCHEDULED => 'SCHEDULED', + self::ADDED => 'ADDED', + self::UNSCHEDULED => 'UNSCHEDULED', + self::CANCELED => 'CANCELED', + self::REPLACEMENT => 'REPLACEMENT', + self::DUPLICATED => 'DUPLICATED', + self::DELETED => 'DELETED', + self::PBNEW => 'NEW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ScheduleRelationship::class, \Google\Transit\Realtime\TripDescriptor_ScheduleRelationship::class); + diff --git a/src/Google/Transit/Realtime/TripDescriptor_ModifiedTripSelector.php b/src/Google/Transit/Realtime/TripDescriptor_ModifiedTripSelector.php new file mode 100644 index 0000000..86b619b --- /dev/null +++ b/src/Google/Transit/Realtime/TripDescriptor_ModifiedTripSelector.php @@ -0,0 +1,16 @@ +transit_realtime.TripModifications + */ +class TripModifications extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .transit_realtime.TripModifications.SelectedTrips selected_trips = 1; + */ + private $selected_trips; + /** + * Generated from protobuf field repeated string start_times = 2; + */ + private $start_times; + /** + * Generated from protobuf field repeated string service_dates = 3; + */ + private $service_dates; + /** + * Generated from protobuf field repeated .transit_realtime.TripModifications.Modification modifications = 4; + */ + private $modifications; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Transit\Realtime\TripModifications\SelectedTrips>|\Google\Protobuf\Internal\RepeatedField $selected_trips + * @type array|\Google\Protobuf\Internal\RepeatedField $start_times + * @type array|\Google\Protobuf\Internal\RepeatedField $service_dates + * @type array<\Google\Transit\Realtime\TripModifications\Modification>|\Google\Protobuf\Internal\RepeatedField $modifications + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated .transit_realtime.TripModifications.SelectedTrips selected_trips = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSelectedTrips() + { + return $this->selected_trips; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TripModifications.SelectedTrips selected_trips = 1; + * @param array<\Google\Transit\Realtime\TripModifications\SelectedTrips>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSelectedTrips($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TripModifications\SelectedTrips::class); + $this->selected_trips = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated string start_times = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTimes() + { + return $this->start_times; + } + + /** + * Generated from protobuf field repeated string start_times = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->start_times = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated string service_dates = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServiceDates() + { + return $this->service_dates; + } + + /** + * Generated from protobuf field repeated string service_dates = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServiceDates($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->service_dates = $arr; + + return $this; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TripModifications.Modification modifications = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModifications() + { + return $this->modifications; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TripModifications.Modification modifications = 4; + * @param array<\Google\Transit\Realtime\TripModifications\Modification>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModifications($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TripModifications\Modification::class); + $this->modifications = $arr; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/TripModifications/Modification.php b/src/Google/Transit/Realtime/TripModifications/Modification.php new file mode 100644 index 0000000..c7fab12 --- /dev/null +++ b/src/Google/Transit/Realtime/TripModifications/Modification.php @@ -0,0 +1,216 @@ +transit_realtime.TripModifications.Modification + */ +class Modification extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field .transit_realtime.StopSelector start_stop_selector = 1; + */ + protected $start_stop_selector = null; + /** + * Generated from protobuf field .transit_realtime.StopSelector end_stop_selector = 2; + */ + protected $end_stop_selector = null; + /** + * Generated from protobuf field int32 propagated_modification_delay = 3; + */ + protected $propagated_modification_delay = 0; + /** + * Generated from protobuf field repeated .transit_realtime.ReplacementStop replacement_stops = 4; + */ + private $replacement_stops; + /** + * Generated from protobuf field string service_alert_id = 5; + */ + protected $service_alert_id = ''; + /** + * Generated from protobuf field uint64 last_modified_time = 6; + */ + protected $last_modified_time = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Transit\Realtime\StopSelector $start_stop_selector + * @type \Google\Transit\Realtime\StopSelector $end_stop_selector + * @type int $propagated_modification_delay + * @type array<\Google\Transit\Realtime\ReplacementStop>|\Google\Protobuf\Internal\RepeatedField $replacement_stops + * @type string $service_alert_id + * @type int|string $last_modified_time + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .transit_realtime.StopSelector start_stop_selector = 1; + * @return \Google\Transit\Realtime\StopSelector|null + */ + public function getStartStopSelector() + { + return $this->start_stop_selector; + } + + public function hasStartStopSelector() + { + return isset($this->start_stop_selector); + } + + public function clearStartStopSelector() + { + unset($this->start_stop_selector); + } + + /** + * Generated from protobuf field .transit_realtime.StopSelector start_stop_selector = 1; + * @param \Google\Transit\Realtime\StopSelector $var + * @return $this + */ + public function setStartStopSelector($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\StopSelector::class); + $this->start_stop_selector = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.StopSelector end_stop_selector = 2; + * @return \Google\Transit\Realtime\StopSelector|null + */ + public function getEndStopSelector() + { + return $this->end_stop_selector; + } + + public function hasEndStopSelector() + { + return isset($this->end_stop_selector); + } + + public function clearEndStopSelector() + { + unset($this->end_stop_selector); + } + + /** + * Generated from protobuf field .transit_realtime.StopSelector end_stop_selector = 2; + * @param \Google\Transit\Realtime\StopSelector $var + * @return $this + */ + public function setEndStopSelector($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\StopSelector::class); + $this->end_stop_selector = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 propagated_modification_delay = 3; + * @return int + */ + public function getPropagatedModificationDelay() + { + return $this->propagated_modification_delay; + } + + /** + * Generated from protobuf field int32 propagated_modification_delay = 3; + * @param int $var + * @return $this + */ + public function setPropagatedModificationDelay($var) + { + GPBUtil::checkInt32($var); + $this->propagated_modification_delay = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .transit_realtime.ReplacementStop replacement_stops = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplacementStops() + { + return $this->replacement_stops; + } + + /** + * Generated from protobuf field repeated .transit_realtime.ReplacementStop replacement_stops = 4; + * @param array<\Google\Transit\Realtime\ReplacementStop>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplacementStops($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\ReplacementStop::class); + $this->replacement_stops = $arr; + + return $this; + } + + /** + * Generated from protobuf field string service_alert_id = 5; + * @return string + */ + public function getServiceAlertId() + { + return $this->service_alert_id; + } + + /** + * Generated from protobuf field string service_alert_id = 5; + * @param string $var + * @return $this + */ + public function setServiceAlertId($var) + { + GPBUtil::checkString($var, True); + $this->service_alert_id = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 last_modified_time = 6; + * @return int|string + */ + public function getLastModifiedTime() + { + return $this->last_modified_time; + } + + /** + * Generated from protobuf field uint64 last_modified_time = 6; + * @param int|string $var + * @return $this + */ + public function setLastModifiedTime($var) + { + GPBUtil::checkUint64($var); + $this->last_modified_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Modification::class, \Google\Transit\Realtime\TripModifications_Modification::class); + diff --git a/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php b/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php new file mode 100644 index 0000000..294df68 --- /dev/null +++ b/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php @@ -0,0 +1,88 @@ +transit_realtime.TripModifications.SelectedTrips + */ +class SelectedTrips extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated string trip_ids = 1; + */ + private $trip_ids; + /** + * Generated from protobuf field string shape_id = 2; + */ + protected $shape_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $trip_ids + * @type string $shape_id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field repeated string trip_ids = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTripIds() + { + return $this->trip_ids; + } + + /** + * Generated from protobuf field repeated string trip_ids = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTripIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->trip_ids = $arr; + + return $this; + } + + /** + * Generated from protobuf field string shape_id = 2; + * @return string + */ + public function getShapeId() + { + return $this->shape_id; + } + + /** + * Generated from protobuf field string shape_id = 2; + * @param string $var + * @return $this + */ + public function setShapeId($var) + { + GPBUtil::checkString($var, True); + $this->shape_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SelectedTrips::class, \Google\Transit\Realtime\TripModifications_SelectedTrips::class); + diff --git a/src/Google/Transit/Realtime/TripModifications_Modification.php b/src/Google/Transit/Realtime/TripModifications_Modification.php new file mode 100644 index 0000000..60bc132 --- /dev/null +++ b/src/Google/Transit/Realtime/TripModifications_Modification.php @@ -0,0 +1,16 @@ +transit_realtime.TripUpdate + */ +class TripUpdate extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 1; + */ + protected $trip = null; + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor vehicle = 3; + */ + protected $vehicle = null; + /** + * Generated from protobuf field repeated .transit_realtime.TripUpdate.StopTimeUpdate stop_time_update = 2; + */ + private $stop_time_update; + /** + * Generated from protobuf field uint64 timestamp = 4; + */ + protected $timestamp = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field int32 delay = 5; + */ + protected $delay = 0; + /** + * Generated from protobuf field .transit_realtime.TripUpdate.TripProperties trip_properties = 6; + */ + protected $trip_properties = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Transit\Realtime\TripDescriptor $trip + * @type \Google\Transit\Realtime\VehicleDescriptor $vehicle + * @type array<\Google\Transit\Realtime\TripUpdate\StopTimeUpdate>|\Google\Protobuf\Internal\RepeatedField $stop_time_update + * @type int|string $timestamp + * @type int $delay + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type \Google\Transit\Realtime\TripUpdate\TripProperties $trip_properties + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 1; + * @return \Google\Transit\Realtime\TripDescriptor|null + */ + public function getTrip() + { + return $this->trip; + } + + public function hasTrip() + { + return isset($this->trip); + } + + public function clearTrip() + { + unset($this->trip); + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 1; + * @param \Google\Transit\Realtime\TripDescriptor $var + * @return $this + */ + public function setTrip($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor::class); + $this->trip = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor vehicle = 3; + * @return \Google\Transit\Realtime\VehicleDescriptor|null + */ + public function getVehicle() + { + return $this->vehicle; + } + + public function hasVehicle() + { + return isset($this->vehicle); + } + + public function clearVehicle() + { + unset($this->vehicle); + } + + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor vehicle = 3; + * @param \Google\Transit\Realtime\VehicleDescriptor $var + * @return $this + */ + public function setVehicle($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\VehicleDescriptor::class); + $this->vehicle = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TripUpdate.StopTimeUpdate stop_time_update = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStopTimeUpdate() + { + return $this->stop_time_update; + } + + /** + * Generated from protobuf field repeated .transit_realtime.TripUpdate.StopTimeUpdate stop_time_update = 2; + * @param array<\Google\Transit\Realtime\TripUpdate\StopTimeUpdate>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStopTimeUpdate($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate::class); + $this->stop_time_update = $arr; + + return $this; + } + + /** + * Generated from protobuf field uint64 timestamp = 4; + * @return int|string + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * Generated from protobuf field uint64 timestamp = 4; + * @param int|string $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkUint64($var); + $this->timestamp = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field int32 delay = 5; + * @return int + */ + public function getDelay() + { + return $this->delay; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field int32 delay = 5; + * @param int $var + * @return $this + */ + public function setDelay($var) + { + GPBUtil::checkInt32($var); + $this->delay = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.TripProperties trip_properties = 6; + * @return \Google\Transit\Realtime\TripUpdate\TripProperties|null + */ + public function getTripProperties() + { + return $this->trip_properties; + } + + public function hasTripProperties() + { + return isset($this->trip_properties); + } + + public function clearTripProperties() + { + unset($this->trip_properties); + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.TripProperties trip_properties = 6; + * @param \Google\Transit\Realtime\TripUpdate\TripProperties $var + * @return $this + */ + public function setTripProperties($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\TripProperties::class); + $this->trip_properties = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php new file mode 100644 index 0000000..481d8ff --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php @@ -0,0 +1,149 @@ +transit_realtime.TripUpdate.StopTimeEvent + */ +class StopTimeEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 delay = 1; + */ + protected $delay = 0; + /** + * Generated from protobuf field int64 time = 2; + */ + protected $time = 0; + /** + * Generated from protobuf field int32 uncertainty = 3; + */ + protected $uncertainty = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field int64 scheduled_time = 4; + */ + protected $scheduled_time = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $delay + * @type int|string $time + * @type int $uncertainty + * @type int|string $scheduled_time + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 delay = 1; + * @return int + */ + public function getDelay() + { + return $this->delay; + } + + /** + * Generated from protobuf field int32 delay = 1; + * @param int $var + * @return $this + */ + public function setDelay($var) + { + GPBUtil::checkInt32($var); + $this->delay = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 time = 2; + * @return int|string + */ + public function getTime() + { + return $this->time; + } + + /** + * Generated from protobuf field int64 time = 2; + * @param int|string $var + * @return $this + */ + public function setTime($var) + { + GPBUtil::checkInt64($var); + $this->time = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 uncertainty = 3; + * @return int + */ + public function getUncertainty() + { + return $this->uncertainty; + } + + /** + * Generated from protobuf field int32 uncertainty = 3; + * @param int $var + * @return $this + */ + public function setUncertainty($var) + { + GPBUtil::checkInt32($var); + $this->uncertainty = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field int64 scheduled_time = 4; + * @return int|string + */ + public function getScheduledTime() + { + return $this->scheduled_time; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field int64 scheduled_time = 4; + * @param int|string $var + * @return $this + */ + public function setScheduledTime($var) + { + GPBUtil::checkInt64($var); + $this->scheduled_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StopTimeEvent::class, \Google\Transit\Realtime\TripUpdate_StopTimeEvent::class); + diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php new file mode 100644 index 0000000..a2f12c5 --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php @@ -0,0 +1,260 @@ +transit_realtime.TripUpdate.StopTimeUpdate + */ +class StopTimeUpdate extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field uint32 stop_sequence = 1; + */ + protected $stop_sequence = 0; + /** + * Generated from protobuf field string stop_id = 4; + */ + protected $stop_id = ''; + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeEvent arrival = 2; + */ + protected $arrival = null; + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeEvent departure = 3; + */ + protected $departure = null; + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus departure_occupancy_status = 7; + */ + protected $departure_occupancy_status = 0; + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship schedule_relationship = 5; + */ + protected $schedule_relationship = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties stop_time_properties = 6; + */ + protected $stop_time_properties = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $stop_sequence + * @type string $stop_id + * @type \Google\Transit\Realtime\TripUpdate\StopTimeEvent $arrival + * @type \Google\Transit\Realtime\TripUpdate\StopTimeEvent $departure + * @type int $departure_occupancy_status + * @type int $schedule_relationship + * @type \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties $stop_time_properties + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field uint32 stop_sequence = 1; + * @return int + */ + public function getStopSequence() + { + return $this->stop_sequence; + } + + /** + * Generated from protobuf field uint32 stop_sequence = 1; + * @param int $var + * @return $this + */ + public function setStopSequence($var) + { + GPBUtil::checkUint32($var); + $this->stop_sequence = $var; + + return $this; + } + + /** + * Generated from protobuf field string stop_id = 4; + * @return string + */ + public function getStopId() + { + return $this->stop_id; + } + + /** + * Generated from protobuf field string stop_id = 4; + * @param string $var + * @return $this + */ + public function setStopId($var) + { + GPBUtil::checkString($var, True); + $this->stop_id = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeEvent arrival = 2; + * @return \Google\Transit\Realtime\TripUpdate\StopTimeEvent|null + */ + public function getArrival() + { + return $this->arrival; + } + + public function hasArrival() + { + return isset($this->arrival); + } + + public function clearArrival() + { + unset($this->arrival); + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeEvent arrival = 2; + * @param \Google\Transit\Realtime\TripUpdate\StopTimeEvent $var + * @return $this + */ + public function setArrival($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\StopTimeEvent::class); + $this->arrival = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeEvent departure = 3; + * @return \Google\Transit\Realtime\TripUpdate\StopTimeEvent|null + */ + public function getDeparture() + { + return $this->departure; + } + + public function hasDeparture() + { + return isset($this->departure); + } + + public function clearDeparture() + { + unset($this->departure); + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeEvent departure = 3; + * @param \Google\Transit\Realtime\TripUpdate\StopTimeEvent $var + * @return $this + */ + public function setDeparture($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\StopTimeEvent::class); + $this->departure = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus departure_occupancy_status = 7; + * @return int + */ + public function getDepartureOccupancyStatus() + { + return $this->departure_occupancy_status; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus departure_occupancy_status = 7; + * @param int $var + * @return $this + */ + public function setDepartureOccupancyStatus($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\OccupancyStatus::class); + $this->departure_occupancy_status = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship schedule_relationship = 5; + * @return int + */ + public function getScheduleRelationship() + { + return $this->schedule_relationship; + } + + /** + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship schedule_relationship = 5; + * @param int $var + * @return $this + */ + public function setScheduleRelationship($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship::class); + $this->schedule_relationship = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties stop_time_properties = 6; + * @return \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties|null + */ + public function getStopTimeProperties() + { + return $this->stop_time_properties; + } + + public function hasStopTimeProperties() + { + return isset($this->stop_time_properties); + } + + public function clearStopTimeProperties() + { + unset($this->stop_time_properties); + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties stop_time_properties = 6; + * @param \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties $var + * @return $this + */ + public function setStopTimeProperties($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties::class); + $this->stop_time_properties = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StopTimeUpdate::class, \Google\Transit\Realtime\TripUpdate_StopTimeUpdate::class); + diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php new file mode 100644 index 0000000..ca358e2 --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php @@ -0,0 +1,63 @@ +transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship + */ +class ScheduleRelationship +{ + /** + * Generated from protobuf enum SCHEDULED = 0; + */ + const SCHEDULED = 0; + /** + * Generated from protobuf enum SKIPPED = 1; + */ + const SKIPPED = 1; + /** + * Generated from protobuf enum NO_DATA = 2; + */ + const NO_DATA = 2; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf enum UNSCHEDULED = 3; + */ + const UNSCHEDULED = 3; + + private static $valueToName = [ + self::SCHEDULED => 'SCHEDULED', + self::SKIPPED => 'SKIPPED', + self::NO_DATA => 'NO_DATA', + self::UNSCHEDULED => 'UNSCHEDULED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ScheduleRelationship::class, \Google\Transit\Realtime\TripUpdate_StopTimeUpdate_ScheduleRelationship::class); + diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.php new file mode 100644 index 0000000..f2a85a1 --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.php @@ -0,0 +1,165 @@ +transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties + */ +class StopTimeProperties extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string assigned_stop_id = 1; + */ + protected $assigned_stop_id = ''; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string stop_headsign = 2; + */ + protected $stop_headsign = ''; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType pickup_type = 3; + */ + protected $pickup_type = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType drop_off_type = 4; + */ + protected $drop_off_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $assigned_stop_id + * @type string $stop_headsign + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type int $pickup_type + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type int $drop_off_type + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string assigned_stop_id = 1; + * @return string + */ + public function getAssignedStopId() + { + return $this->assigned_stop_id; + } + + /** + * Generated from protobuf field string assigned_stop_id = 1; + * @param string $var + * @return $this + */ + public function setAssignedStopId($var) + { + GPBUtil::checkString($var, True); + $this->assigned_stop_id = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string stop_headsign = 2; + * @return string + */ + public function getStopHeadsign() + { + return $this->stop_headsign; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string stop_headsign = 2; + * @param string $var + * @return $this + */ + public function setStopHeadsign($var) + { + GPBUtil::checkString($var, True); + $this->stop_headsign = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType pickup_type = 3; + * @return int + */ + public function getPickupType() + { + return $this->pickup_type; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType pickup_type = 3; + * @param int $var + * @return $this + */ + public function setPickupType($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType::class); + $this->pickup_type = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType drop_off_type = 4; + * @return int + */ + public function getDropOffType() + { + return $this->drop_off_type; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType drop_off_type = 4; + * @param int $var + * @return $this + */ + public function setDropOffType($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType::class); + $this->drop_off_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StopTimeProperties::class, \Google\Transit\Realtime\TripUpdate_StopTimeUpdate_StopTimeProperties::class); + diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php new file mode 100644 index 0000000..e1e4fd6 --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php @@ -0,0 +1,61 @@ +transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType + */ +class DropOffPickupType +{ + /** + * Generated from protobuf enum REGULAR = 0; + */ + const REGULAR = 0; + /** + * Generated from protobuf enum NONE = 1; + */ + const NONE = 1; + /** + * Generated from protobuf enum PHONE_AGENCY = 2; + */ + const PHONE_AGENCY = 2; + /** + * Generated from protobuf enum COORDINATE_WITH_DRIVER = 3; + */ + const COORDINATE_WITH_DRIVER = 3; + + private static $valueToName = [ + self::REGULAR => 'REGULAR', + self::NONE => 'NONE', + self::PHONE_AGENCY => 'PHONE_AGENCY', + self::COORDINATE_WITH_DRIVER => 'COORDINATE_WITH_DRIVER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DropOffPickupType::class, \Google\Transit\Realtime\TripUpdate_StopTimeUpdate_StopTimeProperties_DropOffPickupType::class); + diff --git a/src/Google/Transit/Realtime/TripUpdate/TripProperties.php b/src/Google/Transit/Realtime/TripUpdate/TripProperties.php new file mode 100644 index 0000000..028135f --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate/TripProperties.php @@ -0,0 +1,212 @@ +transit_realtime.TripUpdate.TripProperties + */ +class TripProperties extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string trip_id = 1; + */ + protected $trip_id = ''; + /** + * Generated from protobuf field string start_date = 2; + */ + protected $start_date = ''; + /** + * Generated from protobuf field string start_time = 3; + */ + protected $start_time = ''; + /** + * Generated from protobuf field string shape_id = 4; + */ + protected $shape_id = ''; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string trip_headsign = 5; + */ + protected $trip_headsign = ''; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string trip_short_name = 6; + */ + protected $trip_short_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $trip_id + * @type string $start_date + * @type string $start_time + * @type string $shape_id + * @type string $trip_headsign + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type string $trip_short_name + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string trip_id = 1; + * @return string + */ + public function getTripId() + { + return $this->trip_id; + } + + /** + * Generated from protobuf field string trip_id = 1; + * @param string $var + * @return $this + */ + public function setTripId($var) + { + GPBUtil::checkString($var, True); + $this->trip_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string start_date = 2; + * @return string + */ + public function getStartDate() + { + return $this->start_date; + } + + /** + * Generated from protobuf field string start_date = 2; + * @param string $var + * @return $this + */ + public function setStartDate($var) + { + GPBUtil::checkString($var, True); + $this->start_date = $var; + + return $this; + } + + /** + * Generated from protobuf field string start_time = 3; + * @return string + */ + public function getStartTime() + { + return $this->start_time; + } + + /** + * Generated from protobuf field string start_time = 3; + * @param string $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkString($var, True); + $this->start_time = $var; + + return $this; + } + + /** + * Generated from protobuf field string shape_id = 4; + * @return string + */ + public function getShapeId() + { + return $this->shape_id; + } + + /** + * Generated from protobuf field string shape_id = 4; + * @param string $var + * @return $this + */ + public function setShapeId($var) + { + GPBUtil::checkString($var, True); + $this->shape_id = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string trip_headsign = 5; + * @return string + */ + public function getTripHeadsign() + { + return $this->trip_headsign; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string trip_headsign = 5; + * @param string $var + * @return $this + */ + public function setTripHeadsign($var) + { + GPBUtil::checkString($var, True); + $this->trip_headsign = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string trip_short_name = 6; + * @return string + */ + public function getTripShortName() + { + return $this->trip_short_name; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field string trip_short_name = 6; + * @param string $var + * @return $this + */ + public function setTripShortName($var) + { + GPBUtil::checkString($var, True); + $this->trip_short_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TripProperties::class, \Google\Transit\Realtime\TripUpdate_TripProperties::class); + diff --git a/src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php b/src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php new file mode 100644 index 0000000..2c34cf4 --- /dev/null +++ b/src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php @@ -0,0 +1,16 @@ +transit_realtime.VehicleDescriptor + */ +class VehicleDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + /** + * Generated from protobuf field string license_plate = 3; + */ + protected $license_plate = ''; + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor.WheelchairAccessible wheelchair_accessible = 4; + */ + protected $wheelchair_accessible = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * @type string $label + * @type string $license_plate + * @type int $wheelchair_accessible + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Generated from protobuf field string license_plate = 3; + * @return string + */ + public function getLicensePlate() + { + return $this->license_plate; + } + + /** + * Generated from protobuf field string license_plate = 3; + * @param string $var + * @return $this + */ + public function setLicensePlate($var) + { + GPBUtil::checkString($var, True); + $this->license_plate = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor.WheelchairAccessible wheelchair_accessible = 4; + * @return int + */ + public function getWheelchairAccessible() + { + return $this->wheelchair_accessible; + } + + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor.WheelchairAccessible wheelchair_accessible = 4; + * @param int $var + * @return $this + */ + public function setWheelchairAccessible($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehicleDescriptor\WheelchairAccessible::class); + $this->wheelchair_accessible = $var; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php b/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php new file mode 100644 index 0000000..7340de4 --- /dev/null +++ b/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php @@ -0,0 +1,61 @@ +transit_realtime.VehicleDescriptor.WheelchairAccessible + */ +class WheelchairAccessible +{ + /** + * Generated from protobuf enum NO_VALUE = 0; + */ + const NO_VALUE = 0; + /** + * Generated from protobuf enum UNKNOWN = 1; + */ + const UNKNOWN = 1; + /** + * Generated from protobuf enum WHEELCHAIR_ACCESSIBLE = 2; + */ + const WHEELCHAIR_ACCESSIBLE = 2; + /** + * Generated from protobuf enum WHEELCHAIR_INACCESSIBLE = 3; + */ + const WHEELCHAIR_INACCESSIBLE = 3; + + private static $valueToName = [ + self::NO_VALUE => 'NO_VALUE', + self::UNKNOWN => 'UNKNOWN', + self::WHEELCHAIR_ACCESSIBLE => 'WHEELCHAIR_ACCESSIBLE', + self::WHEELCHAIR_INACCESSIBLE => 'WHEELCHAIR_INACCESSIBLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WheelchairAccessible::class, \Google\Transit\Realtime\VehicleDescriptor_WheelchairAccessible::class); + diff --git a/src/Google/Transit/Realtime/VehicleDescriptor_WheelchairAccessible.php b/src/Google/Transit/Realtime/VehicleDescriptor_WheelchairAccessible.php new file mode 100644 index 0000000..2232e5d --- /dev/null +++ b/src/Google/Transit/Realtime/VehicleDescriptor_WheelchairAccessible.php @@ -0,0 +1,16 @@ +transit_realtime.VehiclePosition + */ +class VehiclePosition extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 1; + */ + protected $trip = null; + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor vehicle = 8; + */ + protected $vehicle = null; + /** + * Generated from protobuf field .transit_realtime.Position position = 2; + */ + protected $position = null; + /** + * Generated from protobuf field uint32 current_stop_sequence = 3; + */ + protected $current_stop_sequence = 0; + /** + * Generated from protobuf field string stop_id = 7; + */ + protected $stop_id = ''; + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.VehicleStopStatus current_status = 4; + */ + protected $current_status = 0; + /** + * Generated from protobuf field uint64 timestamp = 5; + */ + protected $timestamp = 0; + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.CongestionLevel congestion_level = 6; + */ + protected $congestion_level = 0; + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 9; + */ + protected $occupancy_status = 0; + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field uint32 occupancy_percentage = 10; + */ + protected $occupancy_percentage = 0; + /** + * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field repeated .transit_realtime.VehiclePosition.CarriageDetails multi_carriage_details = 11; + */ + private $multi_carriage_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Transit\Realtime\TripDescriptor $trip + * @type \Google\Transit\Realtime\VehicleDescriptor $vehicle + * @type \Google\Transit\Realtime\Position $position + * @type int $current_stop_sequence + * @type string $stop_id + * @type int $current_status + * @type int|string $timestamp + * @type int $congestion_level + * @type int $occupancy_status + * @type int $occupancy_percentage + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * @type array<\Google\Transit\Realtime\VehiclePosition\CarriageDetails>|\Google\Protobuf\Internal\RepeatedField $multi_carriage_details + * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 1; + * @return \Google\Transit\Realtime\TripDescriptor|null + */ + public function getTrip() + { + return $this->trip; + } + + public function hasTrip() + { + return isset($this->trip); + } + + public function clearTrip() + { + unset($this->trip); + } + + /** + * Generated from protobuf field .transit_realtime.TripDescriptor trip = 1; + * @param \Google\Transit\Realtime\TripDescriptor $var + * @return $this + */ + public function setTrip($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor::class); + $this->trip = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor vehicle = 8; + * @return \Google\Transit\Realtime\VehicleDescriptor|null + */ + public function getVehicle() + { + return $this->vehicle; + } + + public function hasVehicle() + { + return isset($this->vehicle); + } + + public function clearVehicle() + { + unset($this->vehicle); + } + + /** + * Generated from protobuf field .transit_realtime.VehicleDescriptor vehicle = 8; + * @param \Google\Transit\Realtime\VehicleDescriptor $var + * @return $this + */ + public function setVehicle($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\VehicleDescriptor::class); + $this->vehicle = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.Position position = 2; + * @return \Google\Transit\Realtime\Position|null + */ + public function getPosition() + { + return $this->position; + } + + public function hasPosition() + { + return isset($this->position); + } + + public function clearPosition() + { + unset($this->position); + } + + /** + * Generated from protobuf field .transit_realtime.Position position = 2; + * @param \Google\Transit\Realtime\Position $var + * @return $this + */ + public function setPosition($var) + { + GPBUtil::checkMessage($var, \Google\Transit\Realtime\Position::class); + $this->position = $var; + + return $this; + } + + /** + * Generated from protobuf field uint32 current_stop_sequence = 3; + * @return int + */ + public function getCurrentStopSequence() + { + return $this->current_stop_sequence; + } + + /** + * Generated from protobuf field uint32 current_stop_sequence = 3; + * @param int $var + * @return $this + */ + public function setCurrentStopSequence($var) + { + GPBUtil::checkUint32($var); + $this->current_stop_sequence = $var; + + return $this; + } + + /** + * Generated from protobuf field string stop_id = 7; + * @return string + */ + public function getStopId() + { + return $this->stop_id; + } + + /** + * Generated from protobuf field string stop_id = 7; + * @param string $var + * @return $this + */ + public function setStopId($var) + { + GPBUtil::checkString($var, True); + $this->stop_id = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.VehicleStopStatus current_status = 4; + * @return int + */ + public function getCurrentStatus() + { + return $this->current_status; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.VehicleStopStatus current_status = 4; + * @param int $var + * @return $this + */ + public function setCurrentStatus($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\VehicleStopStatus::class); + $this->current_status = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 timestamp = 5; + * @return int|string + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * Generated from protobuf field uint64 timestamp = 5; + * @param int|string $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkUint64($var); + $this->timestamp = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.CongestionLevel congestion_level = 6; + * @return int + */ + public function getCongestionLevel() + { + return $this->congestion_level; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.CongestionLevel congestion_level = 6; + * @param int $var + * @return $this + */ + public function setCongestionLevel($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\CongestionLevel::class); + $this->congestion_level = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 9; + * @return int + */ + public function getOccupancyStatus() + { + return $this->occupancy_status; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 9; + * @param int $var + * @return $this + */ + public function setOccupancyStatus($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\OccupancyStatus::class); + $this->occupancy_status = $var; + + return $this; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field uint32 occupancy_percentage = 10; + * @return int + */ + public function getOccupancyPercentage() + { + return $this->occupancy_percentage; + } + + /** + * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field uint32 occupancy_percentage = 10; + * @param int $var + * @return $this + */ + public function setOccupancyPercentage($var) + { + GPBUtil::checkUint32($var); + $this->occupancy_percentage = $var; + + return $this; + } + + /** + * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field repeated .transit_realtime.VehiclePosition.CarriageDetails multi_carriage_details = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMultiCarriageDetails() + { + return $this->multi_carriage_details; + } + + /** + * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. + * + * Generated from protobuf field repeated .transit_realtime.VehiclePosition.CarriageDetails multi_carriage_details = 11; + * @param array<\Google\Transit\Realtime\VehiclePosition\CarriageDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMultiCarriageDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\VehiclePosition\CarriageDetails::class); + $this->multi_carriage_details = $arr; + + return $this; + } + +} + diff --git a/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php b/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php new file mode 100644 index 0000000..2c168a7 --- /dev/null +++ b/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php @@ -0,0 +1,171 @@ +transit_realtime.VehiclePosition.CarriageDetails + */ +class CarriageDetails extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 3; + */ + protected $occupancy_status = 0; + /** + * Generated from protobuf field int32 occupancy_percentage = 4; + */ + protected $occupancy_percentage = 0; + /** + * Generated from protobuf field uint32 carriage_sequence = 5; + */ + protected $carriage_sequence = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * @type string $label + * @type int $occupancy_status + * @type int $occupancy_percentage + * @type int $carriage_sequence + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\GtfsRealtime::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 3; + * @return int + */ + public function getOccupancyStatus() + { + return $this->occupancy_status; + } + + /** + * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 3; + * @param int $var + * @return $this + */ + public function setOccupancyStatus($var) + { + GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\OccupancyStatus::class); + $this->occupancy_status = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 occupancy_percentage = 4; + * @return int + */ + public function getOccupancyPercentage() + { + return $this->occupancy_percentage; + } + + /** + * Generated from protobuf field int32 occupancy_percentage = 4; + * @param int $var + * @return $this + */ + public function setOccupancyPercentage($var) + { + GPBUtil::checkInt32($var); + $this->occupancy_percentage = $var; + + return $this; + } + + /** + * Generated from protobuf field uint32 carriage_sequence = 5; + * @return int + */ + public function getCarriageSequence() + { + return $this->carriage_sequence; + } + + /** + * Generated from protobuf field uint32 carriage_sequence = 5; + * @param int $var + * @return $this + */ + public function setCarriageSequence($var) + { + GPBUtil::checkUint32($var); + $this->carriage_sequence = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CarriageDetails::class, \Google\Transit\Realtime\VehiclePosition_CarriageDetails::class); + diff --git a/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php b/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php new file mode 100644 index 0000000..42dae60 --- /dev/null +++ b/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php @@ -0,0 +1,66 @@ +transit_realtime.VehiclePosition.CongestionLevel + */ +class CongestionLevel +{ + /** + * Generated from protobuf enum UNKNOWN_CONGESTION_LEVEL = 0; + */ + const UNKNOWN_CONGESTION_LEVEL = 0; + /** + * Generated from protobuf enum RUNNING_SMOOTHLY = 1; + */ + const RUNNING_SMOOTHLY = 1; + /** + * Generated from protobuf enum STOP_AND_GO = 2; + */ + const STOP_AND_GO = 2; + /** + * Generated from protobuf enum CONGESTION = 3; + */ + const CONGESTION = 3; + /** + * Generated from protobuf enum SEVERE_CONGESTION = 4; + */ + const SEVERE_CONGESTION = 4; + + private static $valueToName = [ + self::UNKNOWN_CONGESTION_LEVEL => 'UNKNOWN_CONGESTION_LEVEL', + self::RUNNING_SMOOTHLY => 'RUNNING_SMOOTHLY', + self::STOP_AND_GO => 'STOP_AND_GO', + self::CONGESTION => 'CONGESTION', + self::SEVERE_CONGESTION => 'SEVERE_CONGESTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CongestionLevel::class, \Google\Transit\Realtime\VehiclePosition_CongestionLevel::class); + diff --git a/src/Google/Transit/Realtime/VehiclePosition/OccupancyStatus.php b/src/Google/Transit/Realtime/VehiclePosition/OccupancyStatus.php new file mode 100644 index 0000000..9348f09 --- /dev/null +++ b/src/Google/Transit/Realtime/VehiclePosition/OccupancyStatus.php @@ -0,0 +1,90 @@ +transit_realtime.VehiclePosition.OccupancyStatus + */ +class OccupancyStatus +{ + /** + * Generated from protobuf enum EMPTY = 0; + */ + const PBEMPTY = 0; + /** + * Generated from protobuf enum MANY_SEATS_AVAILABLE = 1; + */ + const MANY_SEATS_AVAILABLE = 1; + /** + * Generated from protobuf enum FEW_SEATS_AVAILABLE = 2; + */ + const FEW_SEATS_AVAILABLE = 2; + /** + * Generated from protobuf enum STANDING_ROOM_ONLY = 3; + */ + const STANDING_ROOM_ONLY = 3; + /** + * Generated from protobuf enum CRUSHED_STANDING_ROOM_ONLY = 4; + */ + const CRUSHED_STANDING_ROOM_ONLY = 4; + /** + * Generated from protobuf enum FULL = 5; + */ + const FULL = 5; + /** + * Generated from protobuf enum NOT_ACCEPTING_PASSENGERS = 6; + */ + const NOT_ACCEPTING_PASSENGERS = 6; + /** + * Generated from protobuf enum NO_DATA_AVAILABLE = 7; + */ + const NO_DATA_AVAILABLE = 7; + /** + * Generated from protobuf enum NOT_BOARDABLE = 8; + */ + const NOT_BOARDABLE = 8; + + private static $valueToName = [ + self::PBEMPTY => 'EMPTY', + self::MANY_SEATS_AVAILABLE => 'MANY_SEATS_AVAILABLE', + self::FEW_SEATS_AVAILABLE => 'FEW_SEATS_AVAILABLE', + self::STANDING_ROOM_ONLY => 'STANDING_ROOM_ONLY', + self::CRUSHED_STANDING_ROOM_ONLY => 'CRUSHED_STANDING_ROOM_ONLY', + self::FULL => 'FULL', + self::NOT_ACCEPTING_PASSENGERS => 'NOT_ACCEPTING_PASSENGERS', + self::NO_DATA_AVAILABLE => 'NO_DATA_AVAILABLE', + self::NOT_BOARDABLE => 'NOT_BOARDABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OccupancyStatus::class, \Google\Transit\Realtime\VehiclePosition_OccupancyStatus::class); + diff --git a/src/Google/Transit/Realtime/VehiclePosition/VehicleStopStatus.php b/src/Google/Transit/Realtime/VehiclePosition/VehicleStopStatus.php new file mode 100644 index 0000000..a2b752e --- /dev/null +++ b/src/Google/Transit/Realtime/VehiclePosition/VehicleStopStatus.php @@ -0,0 +1,56 @@ +transit_realtime.VehiclePosition.VehicleStopStatus + */ +class VehicleStopStatus +{ + /** + * Generated from protobuf enum INCOMING_AT = 0; + */ + const INCOMING_AT = 0; + /** + * Generated from protobuf enum STOPPED_AT = 1; + */ + const STOPPED_AT = 1; + /** + * Generated from protobuf enum IN_TRANSIT_TO = 2; + */ + const IN_TRANSIT_TO = 2; + + private static $valueToName = [ + self::INCOMING_AT => 'INCOMING_AT', + self::STOPPED_AT => 'STOPPED_AT', + self::IN_TRANSIT_TO => 'IN_TRANSIT_TO', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VehicleStopStatus::class, \Google\Transit\Realtime\VehiclePosition_VehicleStopStatus::class); + diff --git a/src/Google/Transit/Realtime/VehiclePosition_CarriageDetails.php b/src/Google/Transit/Realtime/VehiclePosition_CarriageDetails.php new file mode 100644 index 0000000..359f3bb --- /dev/null +++ b/src/Google/Transit/Realtime/VehiclePosition_CarriageDetails.php @@ -0,0 +1,16 @@ +assertInstanceOf(FeedMessage::class, $feedMessage); + } + + public function testFeedHeaderSetAndGet(): void + { + $header = new FeedHeader(); + $header->setGtfsRealtimeVersion('2.0'); + $header->setIncrementality(Incrementality::FULL_DATASET); + $header->setTimestamp(1000000); + + $this->assertSame('2.0', $header->getGtfsRealtimeVersion()); + $this->assertSame(Incrementality::FULL_DATASET, $header->getIncrementality()); + $this->assertSame(1000000, $header->getTimestamp()); + } + + public function testFeedEntityWithTripUpdate(): void + { + $tripDescriptor = new TripDescriptor(); + $tripDescriptor->setTripId('trip-1'); + $tripDescriptor->setRouteId('route-1'); + $tripDescriptor->setStartDate('20260101'); + $tripDescriptor->setScheduleRelationship(ScheduleRelationship::SCHEDULED); + + $arrivalEvent = new StopTimeEvent(); + $arrivalEvent->setDelay(60); + $arrivalEvent->setTime(1000000); + $arrivalEvent->setUncertainty(30); + + $departureEvent = new StopTimeEvent(); + $departureEvent->setDelay(90); + + $stopTimeUpdate = new StopTimeUpdate(); + $stopTimeUpdate->setStopSequence(1); + $stopTimeUpdate->setStopId('stop-1'); + $stopTimeUpdate->setArrival($arrivalEvent); + $stopTimeUpdate->setDeparture($departureEvent); + + $tripUpdate = new TripUpdate(); + $tripUpdate->setTrip($tripDescriptor); + $tripUpdate->setTimestamp(1000000); + $tripUpdate->setStopTimeUpdate([$stopTimeUpdate]); + + $entity = new FeedEntity(); + $entity->setId('entity-1'); + $entity->setTripUpdate($tripUpdate); + + $this->assertSame('entity-1', $entity->getId()); + $this->assertTrue($entity->hasTripUpdate()); + $this->assertSame('trip-1', $entity->getTripUpdate()->getTrip()->getTripId()); + $this->assertSame('route-1', $entity->getTripUpdate()->getTrip()->getRouteId()); + $this->assertSame(1, count($entity->getTripUpdate()->getStopTimeUpdate())); + $this->assertSame(60, $entity->getTripUpdate()->getStopTimeUpdate()[0]->getArrival()->getDelay()); + $this->assertSame(90, $entity->getTripUpdate()->getStopTimeUpdate()[0]->getDeparture()->getDelay()); + } + + public function testFeedEntityWithVehiclePosition(): void + { + $position = new Position(); + $position->setLatitude(48.8566); + $position->setLongitude(2.3522); + $position->setBearing(90.0); + $position->setSpeed(15.0); + + $tripDescriptor = new TripDescriptor(); + $tripDescriptor->setTripId('trip-2'); + + $vehicleDescriptor = new VehicleDescriptor(); + $vehicleDescriptor->setId('vehicle-1'); + $vehicleDescriptor->setLabel('Bus 42'); + + $vehiclePosition = new VehiclePosition(); + $vehiclePosition->setTrip($tripDescriptor); + $vehiclePosition->setVehicle($vehicleDescriptor); + $vehiclePosition->setPosition($position); + $vehiclePosition->setCurrentStatus(VehiclePosition\VehicleStopStatus::IN_TRANSIT_TO); + $vehiclePosition->setTimestamp(1000000); + $vehiclePosition->setCongestionLevel(VehiclePosition\CongestionLevel::RUNNING_SMOOTHLY); + $vehiclePosition->setOccupancyStatus(VehiclePosition\OccupancyStatus::MANY_SEATS_AVAILABLE); + + $entity = new FeedEntity(); + $entity->setId('entity-2'); + $entity->setVehicle($vehiclePosition); + + $this->assertTrue($entity->hasVehicle()); + $this->assertSame('vehicle-1', $entity->getVehicle()->getVehicle()->getId()); + $this->assertEqualsWithDelta(48.8566, $entity->getVehicle()->getPosition()->getLatitude(), 0.001); + $this->assertEqualsWithDelta(2.3522, $entity->getVehicle()->getPosition()->getLongitude(), 0.001); + $this->assertSame(VehiclePosition\OccupancyStatus::MANY_SEATS_AVAILABLE, $entity->getVehicle()->getOccupancyStatus()); + } + + public function testFeedEntityWithAlert(): void + { + $translation = new Translation(); + $translation->setText('Service disruption on line 1'); + $translation->setLanguage('en'); + + $translatedString = new TranslatedString(); + $translatedString->setTranslation([$translation]); + + $timeRange = new TimeRange(); + $timeRange->setStart(1000000); + $timeRange->setEnd(1100000); + + $entitySelector = new EntitySelector(); + $entitySelector->setRouteId('route-1'); + + $alert = new Alert(); + $alert->setActivePeriod([$timeRange]); + $alert->setInformedEntity([$entitySelector]); + $alert->setCause(Cause::TECHNICAL_PROBLEM); + $alert->setEffect(Effect::SIGNIFICANT_DELAYS); + $alert->setSeverityLevel(SeverityLevel::WARNING); + $alert->setHeaderText($translatedString); + + $entity = new FeedEntity(); + $entity->setId('entity-3'); + $entity->setAlert($alert); + + $this->assertTrue($entity->hasAlert()); + $this->assertSame(Cause::TECHNICAL_PROBLEM, $entity->getAlert()->getCause()); + $this->assertSame(Effect::SIGNIFICANT_DELAYS, $entity->getAlert()->getEffect()); + $this->assertSame(SeverityLevel::WARNING, $entity->getAlert()->getSeverityLevel()); + $this->assertSame( + 'Service disruption on line 1', + $entity->getAlert()->getHeaderText()->getTranslation()[0]->getText() + ); + } + + public function testSerializeAndDeserializeFeedMessage(): void + { + // Create a feed message + $header = new FeedHeader(); + $header->setGtfsRealtimeVersion('2.0'); + $header->setIncrementality(Incrementality::FULL_DATASET); + $header->setTimestamp(1774000000); + + $tripDescriptor = new TripDescriptor(); + $tripDescriptor->setTripId('trip-serialize-test'); + + $arrivalEvent = new StopTimeEvent(); + $arrivalEvent->setDelay(300); + + $stopTimeUpdate = new StopTimeUpdate(); + $stopTimeUpdate->setStopSequence(5); + $stopTimeUpdate->setStopId('stop-X'); + $stopTimeUpdate->setArrival($arrivalEvent); + + $tripUpdate = new TripUpdate(); + $tripUpdate->setTrip($tripDescriptor); + $tripUpdate->setStopTimeUpdate([$stopTimeUpdate]); + + $entity = new FeedEntity(); + $entity->setId('serialize-entity-1'); + $entity->setTripUpdate($tripUpdate); + + $feedMessage = new FeedMessage(); + $feedMessage->setHeader($header); + $feedMessage->setEntity([$entity]); + + // Serialize + $binaryData = $feedMessage->serializeToString(); + $this->assertNotEmpty($binaryData); + + // Deserialize + $parsedFeed = new FeedMessage(); + $parsedFeed->mergeFromString($binaryData); + + $this->assertSame('2.0', $parsedFeed->getHeader()->getGtfsRealtimeVersion()); + $this->assertSame(1774000000, $parsedFeed->getHeader()->getTimestamp()); + $this->assertSame(1, count($parsedFeed->getEntity())); + $this->assertSame('serialize-entity-1', $parsedFeed->getEntity()[0]->getId()); + $this->assertSame('trip-serialize-test', $parsedFeed->getEntity()[0]->getTripUpdate()->getTrip()->getTripId()); + $this->assertSame(300, $parsedFeed->getEntity()[0]->getTripUpdate()->getStopTimeUpdate()[0]->getArrival()->getDelay()); + $this->assertSame('stop-X', $parsedFeed->getEntity()[0]->getTripUpdate()->getStopTimeUpdate()[0]->getStopId()); + } + + public function testMultipleEntitiesInFeed(): void + { + $feedMessage = new FeedMessage(); + + $header = new FeedHeader(); + $header->setGtfsRealtimeVersion('2.0'); + $header->setTimestamp(1774000000); + $feedMessage->setHeader($header); + + $entities = []; + for ($i = 1; $i <= 3; $i++) { + $entity = new FeedEntity(); + $entity->setId("entity-{$i}"); + + $tripDescriptor = new TripDescriptor(); + $tripDescriptor->setTripId("trip-{$i}"); + + $tripUpdate = new TripUpdate(); + $tripUpdate->setTrip($tripDescriptor); + + $entity->setTripUpdate($tripUpdate); + $entities[] = $entity; + } + + $feedMessage->setEntity($entities); + + $this->assertSame(3, count($feedMessage->getEntity())); + $this->assertSame('entity-2', $feedMessage->getEntity()[1]->getId()); + } + + public function testIsDeletedFeedEntity(): void + { + $entity = new FeedEntity(); + $entity->setId('deleted-entity-1'); + $entity->setIsDeleted(true); + + $this->assertTrue($entity->getIsDeleted()); + } + + public function testEnumDefaultValues(): void + { + $header = new FeedHeader(); + $this->assertSame(Incrementality::FULL_DATASET, $header->getIncrementality()); + + $vehiclePosition = new VehiclePosition(); + $this->assertSame(VehiclePosition\VehicleStopStatus::INCOMING_AT, $vehiclePosition->getCurrentStatus()); + + $tripDescriptor = new TripDescriptor(); + $this->assertSame(ScheduleRelationship::SCHEDULED, $tripDescriptor->getScheduleRelationship()); + } + + public function testJsonSerialization(): void + { + $header = new FeedHeader(); + $header->setGtfsRealtimeVersion('2.0'); + $header->setTimestamp(1774000000); + + $feedMessage = new FeedMessage(); + $feedMessage->setHeader($header); + + $json = $feedMessage->serializeToJsonString(); + $this->assertJson($json); + + $decoded = json_decode($json, true); + $this->assertArrayHasKey('header', $decoded); + $this->assertSame('2.0', $decoded['header']['gtfsRealtimeVersion']); + } +} From bc918b430878264f0f09a978178828f14172fa92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 02:54:31 +0000 Subject: [PATCH 3/5] feat: add generation script, GitHub Actions workflow, MIT license Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/8bb07850-7b03-4937-90ca-56d96cb98035 Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com> --- .github/workflows/generate.yml | 68 ++++++ LICENSE | 201 ++---------------- README.md | 30 ++- bin/generate.sh | 171 +++++++++++++++ composer.json | 2 +- src/GPBMetadata/GtfsRealtime.php | Bin 7986 -> 12921 bytes src/Google/Transit/Realtime/Alert.php | 66 +++--- src/Google/Transit/Realtime/Alert/Cause.php | 6 +- src/Google/Transit/Realtime/Alert/Effect.php | 6 +- .../Transit/Realtime/Alert/SeverityLevel.php | 6 +- src/Google/Transit/Realtime/Alert_Cause.php | 16 -- src/Google/Transit/Realtime/Alert_Effect.php | 16 -- .../Transit/Realtime/Alert_SeverityLevel.php | 16 -- .../Transit/Realtime/EntitySelector.php | 24 +-- src/Google/Transit/Realtime/FeedEntity.php | 30 ++- src/Google/Transit/Realtime/FeedHeader.php | 21 +- .../Realtime/FeedHeader/Incrementality.php | 6 +- .../Realtime/FeedHeader_Incrementality.php | 16 -- src/Google/Transit/Realtime/FeedMessage.php | 16 +- src/Google/Transit/Realtime/Position.php | 20 +- .../Transit/Realtime/ReplacementStop.php | 11 +- src/Google/Transit/Realtime/Shape.php | 13 +- src/Google/Transit/Realtime/Stop.php | 55 +++-- .../Realtime/Stop/WheelchairBoarding.php | 6 +- src/Google/Transit/Realtime/StopSelector.php | 11 +- .../Realtime/Stop_WheelchairBoarding.php | 16 -- src/Google/Transit/Realtime/TimeRange.php | 9 +- .../Transit/Realtime/TranslatedImage.php | 13 +- .../TranslatedImage/LocalizedImage.php | 20 +- .../TranslatedImage_LocalizedImage.php | 16 -- .../Transit/Realtime/TranslatedString.php | 13 +- .../Realtime/TranslatedString/Translation.php | 16 +- .../Realtime/TranslatedString_Translation.php | 16 -- .../Transit/Realtime/TripDescriptor.php | 32 +-- .../TripDescriptor/ModifiedTripSelector.php | 24 +-- .../TripDescriptor/ScheduleRelationship.php | 6 +- .../TripDescriptor_ModifiedTripSelector.php | 16 -- .../TripDescriptor_ScheduleRelationship.php | 16 -- .../Transit/Realtime/TripModifications.php | 37 ++-- .../TripModifications/Modification.php | 30 ++- .../TripModifications/SelectedTrips.php | 20 +- .../TripModifications_Modification.php | 16 -- .../TripModifications_SelectedTrips.php | 16 -- src/Google/Transit/Realtime/TripUpdate.php | 26 ++- .../Realtime/TripUpdate/StopTimeEvent.php | 16 +- .../Realtime/TripUpdate/StopTimeUpdate.php | 35 ++- .../StopTimeUpdate/ScheduleRelationship.php | 6 +- .../StopTimeUpdate/StopTimeProperties.php | 28 ++- .../StopTimeProperties/DropOffPickupType.php | 6 +- .../Realtime/TripUpdate/TripProperties.php | 32 ++- .../Realtime/TripUpdate_StopTimeEvent.php | 16 -- .../Realtime/TripUpdate_StopTimeUpdate.php | 16 -- ...te_StopTimeUpdate_ScheduleRelationship.php | 16 -- ...date_StopTimeUpdate_StopTimeProperties.php | 16 -- ...e_StopTimeProperties_DropOffPickupType.php | 16 -- .../Realtime/TripUpdate_TripProperties.php | 16 -- .../Transit/Realtime/VehicleDescriptor.php | 23 +- .../WheelchairAccessible.php | 6 +- ...VehicleDescriptor_WheelchairAccessible.php | 16 -- .../Transit/Realtime/VehiclePosition.php | 50 +++-- .../VehiclePosition/CarriageDetails.php | 26 ++- .../VehiclePosition/CongestionLevel.php | 6 +- .../VehiclePosition/OccupancyStatus.php | 6 +- .../VehiclePosition/VehicleStopStatus.php | 6 +- .../VehiclePosition_CarriageDetails.php | 16 -- .../VehiclePosition_CongestionLevel.php | 16 -- .../VehiclePosition_OccupancyStatus.php | 16 -- .../VehiclePosition_VehicleStopStatus.php | 16 -- 68 files changed, 648 insertions(+), 965 deletions(-) create mode 100644 .github/workflows/generate.yml create mode 100755 bin/generate.sh delete mode 100644 src/Google/Transit/Realtime/Alert_Cause.php delete mode 100644 src/Google/Transit/Realtime/Alert_Effect.php delete mode 100644 src/Google/Transit/Realtime/Alert_SeverityLevel.php delete mode 100644 src/Google/Transit/Realtime/FeedHeader_Incrementality.php delete mode 100644 src/Google/Transit/Realtime/Stop_WheelchairBoarding.php delete mode 100644 src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php delete mode 100644 src/Google/Transit/Realtime/TranslatedString_Translation.php delete mode 100644 src/Google/Transit/Realtime/TripDescriptor_ModifiedTripSelector.php delete mode 100644 src/Google/Transit/Realtime/TripDescriptor_ScheduleRelationship.php delete mode 100644 src/Google/Transit/Realtime/TripModifications_Modification.php delete mode 100644 src/Google/Transit/Realtime/TripModifications_SelectedTrips.php delete mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php delete mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate.php delete mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate_ScheduleRelationship.php delete mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate_StopTimeProperties.php delete mode 100644 src/Google/Transit/Realtime/TripUpdate_StopTimeUpdate_StopTimeProperties_DropOffPickupType.php delete mode 100644 src/Google/Transit/Realtime/TripUpdate_TripProperties.php delete mode 100644 src/Google/Transit/Realtime/VehicleDescriptor_WheelchairAccessible.php delete mode 100644 src/Google/Transit/Realtime/VehiclePosition_CarriageDetails.php delete mode 100644 src/Google/Transit/Realtime/VehiclePosition_CongestionLevel.php delete mode 100644 src/Google/Transit/Realtime/VehiclePosition_OccupancyStatus.php delete mode 100644 src/Google/Transit/Realtime/VehiclePosition_VehicleStopStatus.php diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml new file mode 100644 index 0000000..f21d559 --- /dev/null +++ b/.github/workflows/generate.yml @@ -0,0 +1,68 @@ +name: Regenerate PHP Classes + +on: + # Run manually from the Actions tab + workflow_dispatch: + inputs: + protoc_version: + description: 'Override protoc version (e.g. 34.1). Leave empty to derive from composer.json.' + required: false + default: '' + + # Run automatically when the google/protobuf version in composer.json changes + push: + branches: + - main + paths: + - 'composer.json' + - 'gtfs-realtime.proto' + +jobs: + generate: + name: Generate PHP classes from proto + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer + + - name: Install Composer dependencies + run: composer install --no-interaction --prefer-dist + + - name: Run generation script + run: | + chmod +x bin/generate.sh + if [[ -n "${{ github.event.inputs.protoc_version }}" ]]; then + bash bin/generate.sh --protoc-version "${{ github.event.inputs.protoc_version }}" + else + bash bin/generate.sh + fi + + - name: Check for changes + id: changes + run: | + if git diff --quiet && git diff --cached --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Commit and push regenerated files + if: steps.changes.outputs.changed == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add src/ + # Include the version of protoc used in the commit message + PROTOC_VERSION=$(grep -oP '"google/protobuf":\s*"\K[^"]+' composer.json || echo "unknown") + git commit -m "chore: regenerate PHP classes (google/protobuf ${PROTOC_VERSION})" + git push diff --git a/LICENSE b/LICENSE index 0c04d3a..7011cb1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,180 +1,21 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship made available under - the License, as indicated by a copyright notice that is included in - or attached with the work (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other transformations - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean, as submitted to the Licensor for inclusion - in the Work by the copyright owner or by an individual or Legal Entity - authorized to submit on behalf of the copyright owner. For the purposes - of this definition, "submit" means any form of electronic, verbal, or - written communication sent to the Licensor or its representatives, - including but not limited to communication on electronic mailing lists, - source code control systems, and issue tracking systems that are managed - by, or on behalf of, the Licensor for the purpose of developing and - improving the Work, but excluding communication that is conspicuously - marked or designated in writing by the copyright owner as "Not a - Contribution." - - "Contributor" shall mean Licensor and any Legal Entity on behalf of - whom a Contribution has been received by the Licensor and included - within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent contributions - Licensors by such Contributor that are necessarily infringed by their - Contribution(s) alone or by the combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a cross-claim - or counterclaim in a lawsuit) alleging that the Work or any - Contribution embodied within the Work constitutes direct or contributory - patent infringement, then any patent licenses granted to You under this - License for that Work shall terminate as of the date such litigation is - filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative - Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then You must include a readable copy of the - attribution notices contained within such NOTICE file, in - at least one of the following places: within a NOTICE text - file distributed as part of the Derivative Works; within - the Source form or documentation, if provided along with the - Derivative Works; or, within a display generated by the - Derivative Works, if and wherever such third-party notices - normally appear. The contents of the NOTICE file are for - informational purposes only and do not modify the License. - You may add Your own attribution notices within Derivative - Works that You distribute, alongside or in addition to the - NOTICE text from the Work, provided that such additional - attribution notices cannot be construed as modifying the License. - - You may add Your own license statement for Your modifications and - may provide additional grant of rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Work, - and to permit persons to whom the Work is furnished to do so, - subject to the following conditions. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or reproducing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or exemplary damages of any character arising as a - result of this License or out of the use or inability to use the - Work (even if such Contributor has been advised of the possibility - of such damages). - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may offer only - conditions consistent with this License in a way that is a separate - agreement with recipients to not impose those restrictions on other - recipients of the Work. - - END OF TERMS AND CONDITIONS - - Copyright 2015 The GTFS Specifications Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +MIT License + +Copyright (c) 2026 dacoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ff11624..d52fe62 100644 --- a/README.md +++ b/README.md @@ -112,12 +112,36 @@ vendor/bin/phpunit ## Regenerating PHP Classes -If you need to regenerate the PHP classes from the proto file: +The PHP classes in `src/` are generated automatically from `gtfs-realtime.proto` using `protoc`. + +### Automatic (GitHub Actions) + +Every time `composer.json` or `gtfs-realtime.proto` is changed on `main`, the +[Regenerate PHP Classes](.github/workflows/generate.yml) workflow runs automatically, +downloads the correct `protoc` binary, regenerates all PHP classes, and commits the result. + +You can also trigger it manually from the **Actions** tab, optionally overriding the `protoc` version. + +### Manual (local) + +Run the generation script — it resolves the `protoc` version from `composer.json` (or `composer.lock`) automatically: ```bash -protoc --php_out=src -I . gtfs-realtime.proto +bash bin/generate.sh ``` +Or override the protoc version explicitly: + +```bash +bash bin/generate.sh --protoc-version 34.1 +``` + +The script: +1. Reads the `google/protobuf` version from `composer.lock` (or `composer.json`) +2. Derives the matching `protoc` release (e.g. PHP `v5.34.1` → `protoc v34.1`) +3. Downloads the `protoc` binary from [github.com/protocolbuffers/protobuf](https://github.com/protocolbuffers/protobuf/releases) +4. Regenerates all PHP classes in `src/` from `gtfs-realtime.proto` + ## License -Apache 2.0 — See [LICENSE](LICENSE) \ No newline at end of file +MIT — See [LICENSE](LICENSE) \ No newline at end of file diff --git a/bin/generate.sh b/bin/generate.sh new file mode 100755 index 0000000..e4ca4f7 --- /dev/null +++ b/bin/generate.sh @@ -0,0 +1,171 @@ +#!/usr/bin/env bash +# generate.sh — Regenerate PHP classes from gtfs-realtime.proto +# +# This script: +# 1. Reads the google/protobuf version from composer.lock (or composer.json) +# 2. Derives the matching protoc version using the unified versioning scheme: +# PHP v{ERA}.{PROTOC_MAJOR}.{PROTOC_MINOR} → protoc v{PROTOC_MAJOR}.{PROTOC_MINOR} +# e.g. google/protobuf v5.34.1 → protoc v34.1 +# 3. Downloads the protoc binary from the protocolbuffers/protobuf GitHub releases +# 4. Regenerates all PHP classes in src/ from gtfs-realtime.proto +# +# Usage: +# ./bin/generate.sh [--protoc-version ] +# +# Options: +# --protoc-version Override the protoc version to use (e.g. 34.1) + +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +# ────────────────────────────────────────────────────────────────────────────── +# 1. Resolve the protoc version +# ────────────────────────────────────────────────────────────────────────────── +PROTOC_VERSION_OVERRIDE="" + +while [[ $# -gt 0 ]]; do + case "$1" in + --protoc-version) + PROTOC_VERSION_OVERRIDE="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" >&2 + exit 1 + ;; + esac +done + +if [[ -n "$PROTOC_VERSION_OVERRIDE" ]]; then + PROTOC_VERSION="$PROTOC_VERSION_OVERRIDE" +else + # Determine the exact google/protobuf version: + # 1. Read from composer.lock (most accurate — uses the installed version) + # 2. Fall back to the constraint in composer.json + PHP_PROTOBUF_VERSION="" + + if [[ -f "${REPO_ROOT}/composer.lock" ]]; then + PHP_PROTOBUF_VERSION="$( + python3 -c " +import json +with open('${REPO_ROOT}/composer.lock') as f: + lock = json.load(f) +for pkg in lock.get('packages', []) + lock.get('packages-dev', []): + if pkg['name'] == 'google/protobuf': + print(pkg['version'].lstrip('v')) + break +" 2>/dev/null + )" + fi + + if [[ -z "$PHP_PROTOBUF_VERSION" ]]; then + PHP_PROTOBUF_VERSION="$( + python3 -c " +import json, re +with open('${REPO_ROOT}/composer.json') as f: + data = json.load(f) +constraint = data['require']['google/protobuf'] +# Strip leading ^ ~ >= < v and whitespace, take first segment +version = re.sub(r'^[\^~>=&2 + exit 1 + ;; + esac + ;; + Darwin) + case "$ARCH" in + x86_64) PROTOC_OS_ARCH="osx-x86_64" ;; + arm64) PROTOC_OS_ARCH="osx-aarch_64" ;; + *) PROTOC_OS_ARCH="osx-universal_binary" ;; + esac + ;; + *) + echo "Unsupported OS: $OS" >&2 + exit 1 + ;; +esac + +PROTOC_ZIP="protoc-${PROTOC_VERSION}-${PROTOC_OS_ARCH}.zip" +PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + +# ────────────────────────────────────────────────────────────────────────────── +# 3. Download and extract protoc +# ────────────────────────────────────────────────────────────────────────────── +WORK_DIR="$(mktemp -d)" +trap 'rm -rf "$WORK_DIR"' EXIT + +echo "→ Downloading ${PROTOC_URL}" +curl -sL -o "${WORK_DIR}/${PROTOC_ZIP}" "$PROTOC_URL" + +unzip -q "${WORK_DIR}/${PROTOC_ZIP}" -d "${WORK_DIR}/protoc" +PROTOC="${WORK_DIR}/protoc/bin/protoc" +chmod +x "$PROTOC" + +echo "→ protoc $("$PROTOC" --version)" + +# ────────────────────────────────────────────────────────────────────────────── +# 4. Generate PHP classes +# ────────────────────────────────────────────────────────────────────────────── +PROTO_FILE="${REPO_ROOT}/gtfs-realtime.proto" +OUT_DIR="${WORK_DIR}/php-out" +mkdir -p "$OUT_DIR" + +echo "→ Generating PHP classes from $(basename "$PROTO_FILE")" +"$PROTOC" \ + --php_out="$OUT_DIR" \ + -I "$(dirname "$PROTO_FILE")" \ + "$PROTO_FILE" + +# ────────────────────────────────────────────────────────────────────────────── +# 5. Replace the generated files in src/ +# ────────────────────────────────────────────────────────────────────────────── +SRC_DIR="${REPO_ROOT}/src" + +echo "→ Replacing generated files in ${SRC_DIR}" + +# Remove old generated files +rm -rf "${SRC_DIR:?}/GPBMetadata" "${SRC_DIR:?}/Google" + +# Copy new generated files +cp -r "${OUT_DIR}/." "${SRC_DIR}/" + +echo "✓ PHP classes successfully regenerated in src/" +echo " Generated files:" +find "${SRC_DIR}" -name "*.php" | sort | sed "s|${REPO_ROOT}/||" diff --git a/composer.json b/composer.json index 6f07009..860a153 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "library", "description": "GTFS-Realtime library for PHP 8.4+ based on Google Protocol Buffers v5", "keywords": ["gtfs", "gtfs-realtime", "protobuf", "transit"], - "license": "Apache-2.0", + "license": "MIT", "require": { "php": ">=8.4", "google/protobuf": "^5.34" diff --git a/src/GPBMetadata/GtfsRealtime.php b/src/GPBMetadata/GtfsRealtime.php index 4550199f36f7e8a82ccd88dfa655fcf6ce1632ef..da7e25999ad2efbc798b5b215bd83e503c8ded22 100644 GIT binary patch literal 12921 zcmcIrZFAa468`RA!FqS^vUj_jBpVxNUxhT-R4{OWlS>s-uhzu(iN z?imST$Gcm*RU}!|)6=g{_w9BLtZCt8BFbow4 zw(DIsPhK|e^4slqSrRYv^dV{L4UUdh@k6rR#Pg(aIqF;|dAx}8`1_-y`7+*a8<$uz z<`qZ(J8Iy+&F93If$Hr~E+$La9r@h^+=6SkaHE6+b zHBVlA(G6KU6LEK z(Kj!?;cbasdfRwW$oTSQO~@Y`dA3W+yEhtHlJBzB_gZdZ@X7p3OZMGQDa+w67G~Qn zT=K#Y(z4^(2gjd%=$yPP{^6b+F#GI->*3?%S-je&c_dDm9jC=Ar_)W6#dWgX#&-!( zf6L#W-6!!P$?#Ph-?$C>;|2cc5Wk?g&#*~su4IYjlC1JH|HxcC;&SpiE~;1p{emv- ziVyU3{OS&185U367AbC2i{2;M7S69pet~bifVru3HP4aS zPG%8NFDUL26Av2};>4Kml!U+se`~FRTi9(+3^H)nMB5`%L4`$joG32xZO8F3{_XZ;2vZU{y65v`veB3OZ!zB3UND z7pB!d*CxeE*Ao+UawJ%^+W-V8?1-y1(ql0;#hM#g;)%rP@00s^wKw~U1vuU2YYCb2 z>iV<#{*!{(`?*-{dfKE9>qUB-&ViZh)s}T>mw0_yXGCVbt}H`PTy(&eK05cRmT!u@ zv?K3PMu^7YJuIwZjVFP<=e}|j9FUdWS7oKx0uI?PqU5VaRvC8=q_tJ9Nj9Bgy^S)6 zDluD2Ya41%hH}keNOD?8f>>bBhEj{jgr-Z@i%=amh`KZpXO#ozX<J3tC=(VpeRVVrnsI&U4;rybvhuFTnAlidbdI-S7XWs zpN=U|R%4agDq2_zE=`X3DAH<^&i}mwmVGn@#fFUXMt@AWde*0lXG2! z3?kN}mx#4>04-S_mHIVX6eQC3XiFGxgI8$D9>lk;o2JM}U;|AkP5x+6_wvVrkC02@ zD9Y>hehsPV>-Z%#*8eRS6tXg1RR`e)$=_v~SZSxhvi#s73N}tf7MSLuO zMxPKcm(Val?oiMf$m!Ne3^ai3iG!qVpqKGG(WcRp_M7TleP7fot>)zlp@~7CTTuV^x3VfbShg3@}1(y?(CMavsbnFi% zy=gQZG8=Dp{E0bq4+M58?AkYjSA*f3K@M5+n2DXY!QecsI|tQC-a7cZm55i+M^c9}zYD9em}SueRt2GQ?V?zfgvw^1iOS zrwEh@uQWY{G{~*=!PfV#VRdl0X+7QJMIIdm2#(J*n+SI@bjP8S%=*W5N_?N|b3vFu z=LPo^MO?e~9P#`ZlDrLz45>1-ExJR}D)ejCI)n@q>OSF#ghwG}5+*TVrwe5$U@ zfrq9RSy_%-$dYm$(?XC)cq2p&+ytdNng^syzlcRA>FA_kTom8zF8cq)^r&kmK0WZ8O`CwBN_w-nHk4TD9Rp>3kJ!i=y8Pct}cu16=|Xw0QHJkH>xbSUGZ7- zmt3`H{=&6ox0YOG&90|;ZE`-RlKY27v<4V}=LRk*U1$di9SsyLo5cNri7c6u$mLe8 zjRF%WI}#S?GAzbw)b|6_LsQ_T0WdHg-i%OOF`}lhr&QvSVPNVU1x(q;(gHAuJ0}D6 zhF9t{SsPw7Hy<*Ku+hpIkm6c-lYg}^usHI>^akv>ZE`}q-;=DiIPTHu1P`h>rh^NT z>d0#S_dZFM^ZPi>qIf>X3oGfn19$$)YuB@{Hb`y0G0c3+OWuibPY*ucb0kXTYrk*G zAN-&lZAuiEIebknVx)D+)Ucx4dUK^zKe+OHV|@arnrcP~95gQTa?eY|xSQY-Y{+pf zfrB;gqJ5<5r&#RCiQ!z}JVBR*k2_L}OwMla0rV4jTu>gou+kBHXpnBxx8of+i&s&T z4J?_mcbEJ7O9zbCrrIXB;n-7@JugfC;=PsPFpWwCfiwzGyTAj5WIFF9WOYKaNR&Yl&^zM=pj{UijsvRSe)C&eD~=`Ppv;w8JN zeDo|&VVtMb)C`+_VIur}F`=qGB3(Jwozh&RhA%q7NL3$Goir}rPnMM}dV$BxQZ6sY zfM0F9mVFtg$X9L9y{oCZJf`d+pVkXhz0G?0aha|J%gR#01&WlEj^>o^GoFs=y$uC6 zFZ7KwZO9R5w|VB_7#6BBD_xLT`#hf+qnZ=aTt!P)VpvY{=gt% z1cMe1)rQ&G7E&;GkJ4nh?Y@}OcDui>SEU}-PUCcfio4r-XFIgBS3ST?F=X+g40Tx~Eo*N_Xqudn)jcVd+IQVcDF@6o2|n|~qK7-7lz9?Rili`9xkMyEfQ$Afia z<_JX&^PCU6(Fspu-~Ad+za^*gYxK(s@=GQP1y9iI(y6!7)2UZt0jLmk6$l6TjSy zn=1igS;5?AvHZGFzzykLrudHL@lpAJg@LDiXV9WBGT8NGzV2oTvSO}ZT-IWVN6J<{ z@Yd_tE+b7jAV?3G*LAk+AYXbbdMpy;K!7CjaHD{|?zJ@nFR5B(SVdov^@OWKWspnF+sIB(v(uiyKa zPd*!6j@av!eP`(SR_OFAXHP5PrBfOCUg+80pmH`oKX?3!?Ol!Bf#cUIm1d`+b&QJA zRE^g_8hB&hb{x=-?0Xvd*#$P{R75^)|C^CEZeEGLu!5kn z51L*?!hXpr_%|A#4P3htgjR_E-f#oc9lD`w4csqqyT_GtYY;d%V1DoUcxZ>NH>?mr zXJ|Y3->!%=Y3~~&57IoYobG$x#lSi3l7JBIR2_znKePs?O((E@cNBVl7h4}byl}!q zEwpm~?T9TM=bl&Yi#tAiICsg%mCzqM)7&c+-wDV5@DaZ^9q=sqi{I?sPu=Jqa=)Lj z-Gj>SCmV_EE%vvEY-f?KrDEt?!@v#A*a%gZ<@X$?-*$q)x^Sd-*y^QY^&P*Is-*7c z>#x*iDQdL+fbXH*&M^8$K)#Jwc`h{4d92UwQ#NZl{gzyG2e)zlj#(l*PHtHBCaqtXf_%1AqG;~Wws+%j0rRX<>b8PX!# z*gI^s%%*I}x?&VxlCaWL_x6;Yq8X~(DyFJmrG-R7K#8%m+mEh~AMne*GjI?wP*3Xq zy7WHFhwvVAJc5Ti{5}gcY+%zN-y_x8+O>1(+5@LV7tPmSn-~8`Z0LG0Ec7RRmt`%4 zVOYv?io5d^GJU3f!KF2FN~_P?r_*QY4VDQ)Z&X_2+wROCr{k;i8I!nhS6<&ecWs2G zHw;SaoaXg;8j`U+y|wzsJY!Rm*I0(mi~O*%_=HJ3N*_!#MTXAT7ch-9HASVcBFScw zm&A4vzP!NCCbz4R$OdR4Gu`krGE_#|WLa3>ddjVkm6~je#4!PSBPic>f=KNz=0hw2 zLlH^&gl)#0m1_jXgbRghR@#8la4YU_E7C2N2i}331>ktf{VglqVTHiHbo%1~f`D(P z`>vFKx5f(b*^yMY*(O&`;QVat;2>^`O=*j*@n!fr4<6|eTeE!My|xCNalZb&#nuwX zCb|<6JZ8DRGqQX@UmOzOg#3_|6LQnD?eWMO+D}cw-EqKOwore6{yH-;Q|rW(IwzD& zc01M*0BRt-`4a9(F;%F4K7ZnKouj5l>h4XQBb}bI9j-<0d2?Rz={I5!IpdV0{5Q>{ z*qW1Nsl*=-ggi1 zrz!6%TH~acmdfl-qtod%RZTV&^H?5T)WdDv2#I3B$8 zCu+BgA1V5wb$Eus;aeB?c$Y&PjJ8oC+>IoJyq`$EjTP4>`6q6E)Je!06{DhIx#BhpmsI z+!o$$kzR!uKA`^OzC87X79;i(unM z9w3EgaDLJDh8L(okPyv*bL|YcMwf!6Mnc&lLON^?<8olL)M2w2_X^vY9EJ>IQ>As` zlo(gkkJ+88F$#6lCTzz#iWwx5K~T!`T5kzZZA6q!L0JB4ifzrT-Kd$6G6&Wf^dtOu zk+1@Qmf*dtuw?A4^fKE{#7rE9?6+CnXWR33My#q@qtjNkeN(2|u)vsZbSSLpcM65) zrmC4nPu6tRFpW+zU3~`OXUzEuD;;W2w9c_+HagnAq8n;QGh51$(!!ZLtk^r$G~%JR zJ00Vob%K+@nmC!V)-?BVF0q~v7gvDf+d59@DN|<_Gu3}W`LjyNv8>YW8Yf^@VmobF zJ27=dHgr=ylGT>H+aege%Wmx{$8#Ujs3auaz%}TCy-ufXb~M~@MfwgaH+qLUFwb1@ zJwpgfm31*IL4LG}rrc;KU4xG4%DS#V5k0-QN`ge_ICY;jQY{hfcH~}@Uva(qXU4Lk zrmeG03mx9IW5S_bkE(HMOzzDGvw=FPXCW}9kJ*+xJoo%7Bt?V(wHjGYwV>!!_;(#; zy^SUi4N%s$#(}`dLjBcwHvC$(25kadt~%(H?J%lKzVp283g0FDfUS)EK~zIm=QkVF z%%L`M`Z}O|cp?3Ws}G=ZE=nZ8mx()RoW=+ zvOAo@#2|y_0^HxY&WcN4`Xjc%Jtsod()QAnAG1y2MKP(gENS&0DV7zkh#*RkM?TaQ zAOL^`7^C#e246^1{25B)KvNrX%k1_#fP*%|o3T~h=&4VXVuoU|skA#97G%OM#PkMR zM?9-dG|7lzR5%BnmfDn0ifi=a81Mof#dTuWmQ~GAG+ApXMJiD?fMYo6u)&XF=wG(F zAa0-n!_tuopvu#&+L$ZRos_oH6Q$Wk^JOE6{B<5gLD8mxrq@L1OvC2HcPrki%Z0Z zbGRq%@ak37_9!iovgICSkH}^`Cm<1=zQuAA@I%h!#Uk(RGN4*eBLXjs9_C8n7{BwDqa13 zM%1`dE%{uHi$i>G96D6HiXs&=oWAP=NC~X4N&}3|nYwqT7EUHEImvilZzl@B59eWn zs_@AT7dLb*wkbv*)K=5rLX1nk{xmTKar(q0PAp{~>6lMPZmv@UC%8ld7Lr~xaMarI zv=Q;AFEcur>Iae@f$N0?&sBeuTCRnG2@w|5z?9SLydatGThfF8h^dA`4bKY2c~9xK zScEO_&`xwjRRTj@v4X797R@Iy2tKLeL{a3fdD?PRR4rVaHjA;@F5e? zq$6>F=`cwQF9Ij&-Lpx{MkdeK7gRVmeVsx&9u&MF_Nu>1vEn36M&(F@=AEKML7+yZ zSZ!Y8vxK#H0aWF8S$^s#pKwuaBb=V2((qzT>6^=3{Sswvyx-}Ie66yrfoF^70aN69 zQ5L@UqPuX~S}P{xKg*a(-&`TYq#{k+2M&rV(zV18Ls((@j=UMKK44ifS;eQMD^H>r zR`vP_;*mFaI&g=vVE@Um40W2*77;WbvK%)Nkwp#iGBsaJ#(R9a*mA`l$`7j7I7dz@ zJn5Toq*{+7`EnddOAy>dRCA=~X+^BSs|aR!=J~=K@)SXng&fAgf{1KG9rALlFdW4w z5={UfAd=Hk6+D@a5rPt*64kdkX^-8S0+%z-^81wgsB|sV-=23a9b!zO$!7r#px1St~Qu70j7in%7GY&UZSF7y2Fb)s>xEi`j-rfKO`iP zgra04sZ?oG>l5XeAd2Y){rDVlP2@I_&jOlFPli+h+;$~Wv*TX_#`!!e0EW}@ewfEV*k~KIQaoi69bpuI zUq|{TdzD7M)&(_h=5$6!QBRKs6pvZy6SnO;@B^E_f^kj(>L}`H7qlt8$yT~2)e1qR zO^Y6U$h!oFmzjjO)i7dA#-v9Bs-iOG2UKVZ8;19NOz}4c{ z&9BmTqo>?co)g^g^fZ1;{&zY*_1t{63VVd!gSV2G)OW-K?bLfNJO%H~3*K`1PVsE} Ij6GxQe>l`?djJ3c diff --git a/src/Google/Transit/Realtime/Alert.php b/src/Google/Transit/Realtime/Alert.php index 050e314..ce15ba9 100644 --- a/src/Google/Transit/Realtime/Alert.php +++ b/src/Google/Transit/Realtime/Alert.php @@ -1,12 +1,13 @@ |\Google\Protobuf\Internal\RepeatedField $active_period - * @type array<\Google\Transit\Realtime\EntitySelector>|\Google\Protobuf\Internal\RepeatedField $informed_entity + * @type \Google\Transit\Realtime\TimeRange[] $active_period + * @type \Google\Transit\Realtime\EntitySelector[] $informed_entity * @type int $cause * @type int $effect * @type \Google\Transit\Realtime\TranslatedString $url @@ -113,7 +114,7 @@ public function __construct($data = NULL) { /** * Generated from protobuf field repeated .transit_realtime.TimeRange active_period = 1; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\TimeRange> */ public function getActivePeriod() { @@ -122,10 +123,10 @@ public function getActivePeriod() /** * Generated from protobuf field repeated .transit_realtime.TimeRange active_period = 1; - * @param array<\Google\Transit\Realtime\TimeRange>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\TimeRange[] $var * @return $this */ - public function setActivePeriod($var) + public function setActivePeriod(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TimeRange::class); $this->active_period = $arr; @@ -135,7 +136,7 @@ public function setActivePeriod($var) /** * Generated from protobuf field repeated .transit_realtime.EntitySelector informed_entity = 5; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\EntitySelector> */ public function getInformedEntity() { @@ -144,10 +145,10 @@ public function getInformedEntity() /** * Generated from protobuf field repeated .transit_realtime.EntitySelector informed_entity = 5; - * @param array<\Google\Transit\Realtime\EntitySelector>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\EntitySelector[] $var * @return $this */ - public function setInformedEntity($var) + public function setInformedEntity(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\EntitySelector::class); $this->informed_entity = $arr; @@ -157,7 +158,7 @@ public function setInformedEntity($var) /** * Generated from protobuf field .transit_realtime.Alert.Cause cause = 6; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\Alert\Cause} */ public function getCause() { @@ -166,10 +167,10 @@ public function getCause() /** * Generated from protobuf field .transit_realtime.Alert.Cause cause = 6; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\Alert\Cause} * @return $this */ - public function setCause($var) + public function setCause(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\Alert\Cause::class); $this->cause = $var; @@ -179,7 +180,7 @@ public function setCause($var) /** * Generated from protobuf field .transit_realtime.Alert.Effect effect = 7; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\Alert\Effect} */ public function getEffect() { @@ -188,10 +189,10 @@ public function getEffect() /** * Generated from protobuf field .transit_realtime.Alert.Effect effect = 7; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\Alert\Effect} * @return $this */ - public function setEffect($var) + public function setEffect(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\Alert\Effect::class); $this->effect = $var; @@ -223,9 +224,8 @@ public function clearUrl() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setUrl($var) + public function setUrl(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->url = $var; return $this; @@ -255,9 +255,8 @@ public function clearHeaderText() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setHeaderText($var) + public function setHeaderText(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->header_text = $var; return $this; @@ -287,9 +286,8 @@ public function clearDescriptionText() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setDescriptionText($var) + public function setDescriptionText(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->description_text = $var; return $this; @@ -319,9 +317,8 @@ public function clearTtsHeaderText() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setTtsHeaderText($var) + public function setTtsHeaderText(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->tts_header_text = $var; return $this; @@ -351,9 +348,8 @@ public function clearTtsDescriptionText() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setTtsDescriptionText($var) + public function setTtsDescriptionText(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->tts_description_text = $var; return $this; @@ -361,7 +357,7 @@ public function setTtsDescriptionText($var) /** * Generated from protobuf field .transit_realtime.Alert.SeverityLevel severity_level = 14; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\Alert\SeverityLevel} */ public function getSeverityLevel() { @@ -370,10 +366,10 @@ public function getSeverityLevel() /** * Generated from protobuf field .transit_realtime.Alert.SeverityLevel severity_level = 14; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\Alert\SeverityLevel} * @return $this */ - public function setSeverityLevel($var) + public function setSeverityLevel(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\Alert\SeverityLevel::class); $this->severity_level = $var; @@ -409,9 +405,8 @@ public function clearImage() * @param \Google\Transit\Realtime\TranslatedImage $var * @return $this */ - public function setImage($var) + public function setImage(\Google\Transit\Realtime\TranslatedImage|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedImage::class); $this->image = $var; return $this; @@ -445,9 +440,8 @@ public function clearImageAlternativeText() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setImageAlternativeText($var) + public function setImageAlternativeText(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->image_alternative_text = $var; return $this; @@ -481,9 +475,8 @@ public function clearCauseDetail() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setCauseDetail($var) + public function setCauseDetail(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->cause_detail = $var; return $this; @@ -517,9 +510,8 @@ public function clearEffectDetail() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setEffectDetail($var) + public function setEffectDetail(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->effect_detail = $var; return $this; diff --git a/src/Google/Transit/Realtime/Alert/Cause.php b/src/Google/Transit/Realtime/Alert/Cause.php index d118784..2ecdf8a 100644 --- a/src/Google/Transit/Realtime/Alert/Cause.php +++ b/src/Google/Transit/Realtime/Alert/Cause.php @@ -1,6 +1,7 @@ agency_id = $var; return $this; @@ -95,9 +96,9 @@ public function getRouteId() * @param string $var * @return $this */ - public function setRouteId($var) + public function setRouteId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->route_id = $var; return $this; @@ -117,7 +118,7 @@ public function getRouteType() * @param int $var * @return $this */ - public function setRouteType($var) + public function setRouteType(int $var) { GPBUtil::checkInt32($var); $this->route_type = $var; @@ -149,9 +150,8 @@ public function clearTrip() * @param \Google\Transit\Realtime\TripDescriptor $var * @return $this */ - public function setTrip($var) + public function setTrip(\Google\Transit\Realtime\TripDescriptor|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor::class); $this->trip = $var; return $this; @@ -171,9 +171,9 @@ public function getStopId() * @param string $var * @return $this */ - public function setStopId($var) + public function setStopId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_id = $var; return $this; @@ -193,7 +193,7 @@ public function getDirectionId() * @param int $var * @return $this */ - public function setDirectionId($var) + public function setDirectionId(int $var) { GPBUtil::checkUint32($var); $this->direction_id = $var; diff --git a/src/Google/Transit/Realtime/FeedEntity.php b/src/Google/Transit/Realtime/FeedEntity.php index 4dfc9b4..6088805 100644 --- a/src/Google/Transit/Realtime/FeedEntity.php +++ b/src/Google/Transit/Realtime/FeedEntity.php @@ -1,12 +1,13 @@ id = $var; return $this; @@ -108,9 +109,8 @@ public function getIsDeleted() * @param bool $var * @return $this */ - public function setIsDeleted($var) + public function setIsDeleted(bool $var) { - GPBUtil::checkBool($var); $this->is_deleted = $var; return $this; @@ -140,9 +140,8 @@ public function clearTripUpdate() * @param \Google\Transit\Realtime\TripUpdate $var * @return $this */ - public function setTripUpdate($var) + public function setTripUpdate(\Google\Transit\Realtime\TripUpdate|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate::class); $this->trip_update = $var; return $this; @@ -172,9 +171,8 @@ public function clearVehicle() * @param \Google\Transit\Realtime\VehiclePosition $var * @return $this */ - public function setVehicle($var) + public function setVehicle(\Google\Transit\Realtime\VehiclePosition|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\VehiclePosition::class); $this->vehicle = $var; return $this; @@ -204,9 +202,8 @@ public function clearAlert() * @param \Google\Transit\Realtime\Alert $var * @return $this */ - public function setAlert($var) + public function setAlert(\Google\Transit\Realtime\Alert|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\Alert::class); $this->alert = $var; return $this; @@ -240,9 +237,8 @@ public function clearShape() * @param \Google\Transit\Realtime\Shape $var * @return $this */ - public function setShape($var) + public function setShape(\Google\Transit\Realtime\Shape|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\Shape::class); $this->shape = $var; return $this; @@ -272,9 +268,8 @@ public function clearStop() * @param \Google\Transit\Realtime\Stop $var * @return $this */ - public function setStop($var) + public function setStop(\Google\Transit\Realtime\Stop|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\Stop::class); $this->stop = $var; return $this; @@ -304,9 +299,8 @@ public function clearTripModifications() * @param \Google\Transit\Realtime\TripModifications $var * @return $this */ - public function setTripModifications($var) + public function setTripModifications(\Google\Transit\Realtime\TripModifications|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripModifications::class); $this->trip_modifications = $var; return $this; diff --git a/src/Google/Transit/Realtime/FeedHeader.php b/src/Google/Transit/Realtime/FeedHeader.php index 21de23c..4d7b4cc 100644 --- a/src/Google/Transit/Realtime/FeedHeader.php +++ b/src/Google/Transit/Realtime/FeedHeader.php @@ -1,12 +1,13 @@ gtfs_realtime_version = $var; return $this; @@ -73,7 +74,7 @@ public function setGtfsRealtimeVersion($var) /** * Generated from protobuf field .transit_realtime.FeedHeader.Incrementality incrementality = 2; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\FeedHeader\Incrementality} */ public function getIncrementality() { @@ -82,10 +83,10 @@ public function getIncrementality() /** * Generated from protobuf field .transit_realtime.FeedHeader.Incrementality incrementality = 2; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\FeedHeader\Incrementality} * @return $this */ - public function setIncrementality($var) + public function setIncrementality(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\FeedHeader\Incrementality::class); $this->incrementality = $var; @@ -107,7 +108,7 @@ public function getTimestamp() * @param int|string $var * @return $this */ - public function setTimestamp($var) + public function setTimestamp(int|string $var) { GPBUtil::checkUint64($var); $this->timestamp = $var; @@ -129,9 +130,9 @@ public function getFeedVersion() * @param string $var * @return $this */ - public function setFeedVersion($var) + public function setFeedVersion(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->feed_version = $var; return $this; diff --git a/src/Google/Transit/Realtime/FeedHeader/Incrementality.php b/src/Google/Transit/Realtime/FeedHeader/Incrementality.php index 21b5c1b..d4c423f 100644 --- a/src/Google/Transit/Realtime/FeedHeader/Incrementality.php +++ b/src/Google/Transit/Realtime/FeedHeader/Incrementality.php @@ -1,6 +1,7 @@ |\Google\Protobuf\Internal\RepeatedField $entity + * @type \Google\Transit\Realtime\FeedEntity[] $entity * } */ public function __construct($data = NULL) { @@ -63,9 +64,8 @@ public function clearHeader() * @param \Google\Transit\Realtime\FeedHeader $var * @return $this */ - public function setHeader($var) + public function setHeader(\Google\Transit\Realtime\FeedHeader|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\FeedHeader::class); $this->header = $var; return $this; @@ -73,7 +73,7 @@ public function setHeader($var) /** * Generated from protobuf field repeated .transit_realtime.FeedEntity entity = 2; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\FeedEntity> */ public function getEntity() { @@ -82,10 +82,10 @@ public function getEntity() /** * Generated from protobuf field repeated .transit_realtime.FeedEntity entity = 2; - * @param array<\Google\Transit\Realtime\FeedEntity>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\FeedEntity[] $var * @return $this */ - public function setEntity($var) + public function setEntity(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\FeedEntity::class); $this->entity = $arr; diff --git a/src/Google/Transit/Realtime/Position.php b/src/Google/Transit/Realtime/Position.php index 356fdc8..3515a14 100644 --- a/src/Google/Transit/Realtime/Position.php +++ b/src/Google/Transit/Realtime/Position.php @@ -1,12 +1,13 @@ latitude = $var; return $this; @@ -90,9 +90,8 @@ public function getLongitude() * @param float $var * @return $this */ - public function setLongitude($var) + public function setLongitude(float $var) { - GPBUtil::checkFloat($var); $this->longitude = $var; return $this; @@ -112,9 +111,8 @@ public function getBearing() * @param float $var * @return $this */ - public function setBearing($var) + public function setBearing(float $var) { - GPBUtil::checkFloat($var); $this->bearing = $var; return $this; @@ -134,9 +132,8 @@ public function getOdometer() * @param float $var * @return $this */ - public function setOdometer($var) + public function setOdometer(float $var) { - GPBUtil::checkDouble($var); $this->odometer = $var; return $this; @@ -156,9 +153,8 @@ public function getSpeed() * @param float $var * @return $this */ - public function setSpeed($var) + public function setSpeed(float $var) { - GPBUtil::checkFloat($var); $this->speed = $var; return $this; diff --git a/src/Google/Transit/Realtime/ReplacementStop.php b/src/Google/Transit/Realtime/ReplacementStop.php index 3fb7d32..d5628d9 100644 --- a/src/Google/Transit/Realtime/ReplacementStop.php +++ b/src/Google/Transit/Realtime/ReplacementStop.php @@ -1,12 +1,13 @@ travel_time_to_stop = $var; @@ -75,9 +76,9 @@ public function getStopId() * @param string $var * @return $this */ - public function setStopId($var) + public function setStopId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_id = $var; return $this; diff --git a/src/Google/Transit/Realtime/Shape.php b/src/Google/Transit/Realtime/Shape.php index da5feaf..249aaf8 100644 --- a/src/Google/Transit/Realtime/Shape.php +++ b/src/Google/Transit/Realtime/Shape.php @@ -1,12 +1,13 @@ shape_id = $var; return $this; @@ -76,9 +77,9 @@ public function getEncodedPolyline() * @param string $var * @return $this */ - public function setEncodedPolyline($var) + public function setEncodedPolyline(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->encoded_polyline = $var; return $this; diff --git a/src/Google/Transit/Realtime/Stop.php b/src/Google/Transit/Realtime/Stop.php index 2023003..3e5bb14 100644 --- a/src/Google/Transit/Realtime/Stop.php +++ b/src/Google/Transit/Realtime/Stop.php @@ -1,12 +1,13 @@ stop_id = $var; return $this; @@ -146,9 +147,8 @@ public function clearStopCode() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setStopCode($var) + public function setStopCode(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->stop_code = $var; return $this; @@ -178,9 +178,8 @@ public function clearStopName() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setStopName($var) + public function setStopName(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->stop_name = $var; return $this; @@ -210,9 +209,8 @@ public function clearTtsStopName() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setTtsStopName($var) + public function setTtsStopName(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->tts_stop_name = $var; return $this; @@ -242,9 +240,8 @@ public function clearStopDesc() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setStopDesc($var) + public function setStopDesc(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->stop_desc = $var; return $this; @@ -264,9 +261,8 @@ public function getStopLat() * @param float $var * @return $this */ - public function setStopLat($var) + public function setStopLat(float $var) { - GPBUtil::checkFloat($var); $this->stop_lat = $var; return $this; @@ -286,9 +282,8 @@ public function getStopLon() * @param float $var * @return $this */ - public function setStopLon($var) + public function setStopLon(float $var) { - GPBUtil::checkFloat($var); $this->stop_lon = $var; return $this; @@ -308,9 +303,9 @@ public function getZoneId() * @param string $var * @return $this */ - public function setZoneId($var) + public function setZoneId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->zone_id = $var; return $this; @@ -340,9 +335,8 @@ public function clearStopUrl() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setStopUrl($var) + public function setStopUrl(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->stop_url = $var; return $this; @@ -362,9 +356,9 @@ public function getParentStation() * @param string $var * @return $this */ - public function setParentStation($var) + public function setParentStation(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->parent_station = $var; return $this; @@ -384,9 +378,9 @@ public function getStopTimezone() * @param string $var * @return $this */ - public function setStopTimezone($var) + public function setStopTimezone(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_timezone = $var; return $this; @@ -394,7 +388,7 @@ public function setStopTimezone($var) /** * Generated from protobuf field .transit_realtime.Stop.WheelchairBoarding wheelchair_boarding = 13; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\Stop\WheelchairBoarding} */ public function getWheelchairBoarding() { @@ -403,10 +397,10 @@ public function getWheelchairBoarding() /** * Generated from protobuf field .transit_realtime.Stop.WheelchairBoarding wheelchair_boarding = 13; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\Stop\WheelchairBoarding} * @return $this */ - public function setWheelchairBoarding($var) + public function setWheelchairBoarding(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\Stop\WheelchairBoarding::class); $this->wheelchair_boarding = $var; @@ -428,9 +422,9 @@ public function getLevelId() * @param string $var * @return $this */ - public function setLevelId($var) + public function setLevelId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->level_id = $var; return $this; @@ -460,9 +454,8 @@ public function clearPlatformCode() * @param \Google\Transit\Realtime\TranslatedString $var * @return $this */ - public function setPlatformCode($var) + public function setPlatformCode(\Google\Transit\Realtime\TranslatedString|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TranslatedString::class); $this->platform_code = $var; return $this; diff --git a/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php b/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php index 20b1cc2..ee78230 100644 --- a/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php +++ b/src/Google/Transit/Realtime/Stop/WheelchairBoarding.php @@ -1,6 +1,7 @@ stop_sequence = $var; @@ -76,9 +77,9 @@ public function getStopId() * @param string $var * @return $this */ - public function setStopId($var) + public function setStopId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_id = $var; return $this; diff --git a/src/Google/Transit/Realtime/Stop_WheelchairBoarding.php b/src/Google/Transit/Realtime/Stop_WheelchairBoarding.php deleted file mode 100644 index 87342e5..0000000 --- a/src/Google/Transit/Realtime/Stop_WheelchairBoarding.php +++ /dev/null @@ -1,16 +0,0 @@ -start = $var; @@ -75,7 +76,7 @@ public function getEnd() * @param int|string $var * @return $this */ - public function setEnd($var) + public function setEnd(int|string $var) { GPBUtil::checkUint64($var); $this->end = $var; diff --git a/src/Google/Transit/Realtime/TranslatedImage.php b/src/Google/Transit/Realtime/TranslatedImage.php index 8c086a3..a9c436a 100644 --- a/src/Google/Transit/Realtime/TranslatedImage.php +++ b/src/Google/Transit/Realtime/TranslatedImage.php @@ -1,12 +1,13 @@ |\Google\Protobuf\Internal\RepeatedField $localized_image + * @type \Google\Transit\Realtime\TranslatedImage\LocalizedImage[] $localized_image * } */ public function __construct($data = NULL) { @@ -37,7 +38,7 @@ public function __construct($data = NULL) { /** * Generated from protobuf field repeated .transit_realtime.TranslatedImage.LocalizedImage localized_image = 1; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\TranslatedImage\LocalizedImage> */ public function getLocalizedImage() { @@ -46,10 +47,10 @@ public function getLocalizedImage() /** * Generated from protobuf field repeated .transit_realtime.TranslatedImage.LocalizedImage localized_image = 1; - * @param array<\Google\Transit\Realtime\TranslatedImage\LocalizedImage>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\TranslatedImage\LocalizedImage[] $var * @return $this */ - public function setLocalizedImage($var) + public function setLocalizedImage(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TranslatedImage\LocalizedImage::class); $this->localized_image = $arr; diff --git a/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php b/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php index 9820a9e..f7287d7 100644 --- a/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php +++ b/src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php @@ -1,12 +1,13 @@ transit_realtime.TranslatedImage.LocalizedImage @@ -56,9 +57,9 @@ public function getUrl() * @param string $var * @return $this */ - public function setUrl($var) + public function setUrl(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->url = $var; return $this; @@ -78,9 +79,9 @@ public function getMediaType() * @param string $var * @return $this */ - public function setMediaType($var) + public function setMediaType(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->media_type = $var; return $this; @@ -100,9 +101,9 @@ public function getLanguage() * @param string $var * @return $this */ - public function setLanguage($var) + public function setLanguage(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->language = $var; return $this; @@ -110,6 +111,3 @@ public function setLanguage($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(LocalizedImage::class, \Google\Transit\Realtime\TranslatedImage_LocalizedImage::class); - diff --git a/src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php b/src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php deleted file mode 100644 index 9349c98..0000000 --- a/src/Google/Transit/Realtime/TranslatedImage_LocalizedImage.php +++ /dev/null @@ -1,16 +0,0 @@ -|\Google\Protobuf\Internal\RepeatedField $translation + * @type \Google\Transit\Realtime\TranslatedString\Translation[] $translation * } */ public function __construct($data = NULL) { @@ -36,7 +37,7 @@ public function __construct($data = NULL) { /** * Generated from protobuf field repeated .transit_realtime.TranslatedString.Translation translation = 1; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\TranslatedString\Translation> */ public function getTranslation() { @@ -45,10 +46,10 @@ public function getTranslation() /** * Generated from protobuf field repeated .transit_realtime.TranslatedString.Translation translation = 1; - * @param array<\Google\Transit\Realtime\TranslatedString\Translation>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\TranslatedString\Translation[] $var * @return $this */ - public function setTranslation($var) + public function setTranslation(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TranslatedString\Translation::class); $this->translation = $arr; diff --git a/src/Google/Transit/Realtime/TranslatedString/Translation.php b/src/Google/Transit/Realtime/TranslatedString/Translation.php index 1c0b1a6..eeedb30 100644 --- a/src/Google/Transit/Realtime/TranslatedString/Translation.php +++ b/src/Google/Transit/Realtime/TranslatedString/Translation.php @@ -1,12 +1,13 @@ transit_realtime.TranslatedString.Translation @@ -51,9 +52,9 @@ public function getText() * @param string $var * @return $this */ - public function setText($var) + public function setText(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->text = $var; return $this; @@ -73,9 +74,9 @@ public function getLanguage() * @param string $var * @return $this */ - public function setLanguage($var) + public function setLanguage(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->language = $var; return $this; @@ -83,6 +84,3 @@ public function setLanguage($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Translation::class, \Google\Transit\Realtime\TranslatedString_Translation::class); - diff --git a/src/Google/Transit/Realtime/TranslatedString_Translation.php b/src/Google/Transit/Realtime/TranslatedString_Translation.php deleted file mode 100644 index af10df6..0000000 --- a/src/Google/Transit/Realtime/TranslatedString_Translation.php +++ /dev/null @@ -1,16 +0,0 @@ -trip_id = $var; return $this; @@ -103,9 +104,9 @@ public function getRouteId() * @param string $var * @return $this */ - public function setRouteId($var) + public function setRouteId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->route_id = $var; return $this; @@ -125,7 +126,7 @@ public function getDirectionId() * @param int $var * @return $this */ - public function setDirectionId($var) + public function setDirectionId(int $var) { GPBUtil::checkUint32($var); $this->direction_id = $var; @@ -147,9 +148,9 @@ public function getStartTime() * @param string $var * @return $this */ - public function setStartTime($var) + public function setStartTime(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->start_time = $var; return $this; @@ -169,9 +170,9 @@ public function getStartDate() * @param string $var * @return $this */ - public function setStartDate($var) + public function setStartDate(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->start_date = $var; return $this; @@ -179,7 +180,7 @@ public function setStartDate($var) /** * Generated from protobuf field .transit_realtime.TripDescriptor.ScheduleRelationship schedule_relationship = 4; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\TripDescriptor\ScheduleRelationship} */ public function getScheduleRelationship() { @@ -188,10 +189,10 @@ public function getScheduleRelationship() /** * Generated from protobuf field .transit_realtime.TripDescriptor.ScheduleRelationship schedule_relationship = 4; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\TripDescriptor\ScheduleRelationship} * @return $this */ - public function setScheduleRelationship($var) + public function setScheduleRelationship(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripDescriptor\ScheduleRelationship::class); $this->schedule_relationship = $var; @@ -227,9 +228,8 @@ public function clearModifiedTrip() * @param \Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector $var * @return $this */ - public function setModifiedTrip($var) + public function setModifiedTrip(\Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor\ModifiedTripSelector::class); $this->modified_trip = $var; return $this; diff --git a/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php b/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php index 57cb844..32e36c8 100644 --- a/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php +++ b/src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php @@ -1,12 +1,13 @@ transit_realtime.TripDescriptor.ModifiedTripSelector @@ -61,9 +62,9 @@ public function getModificationsId() * @param string $var * @return $this */ - public function setModificationsId($var) + public function setModificationsId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->modifications_id = $var; return $this; @@ -83,9 +84,9 @@ public function getAffectedTripId() * @param string $var * @return $this */ - public function setAffectedTripId($var) + public function setAffectedTripId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->affected_trip_id = $var; return $this; @@ -105,9 +106,9 @@ public function getStartTime() * @param string $var * @return $this */ - public function setStartTime($var) + public function setStartTime(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->start_time = $var; return $this; @@ -127,9 +128,9 @@ public function getStartDate() * @param string $var * @return $this */ - public function setStartDate($var) + public function setStartDate(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->start_date = $var; return $this; @@ -137,6 +138,3 @@ public function setStartDate($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ModifiedTripSelector::class, \Google\Transit\Realtime\TripDescriptor_ModifiedTripSelector::class); - diff --git a/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php b/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php index b575f45..bcfd552 100644 --- a/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php +++ b/src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php @@ -1,6 +1,7 @@ |\Google\Protobuf\Internal\RepeatedField $selected_trips - * @type array|\Google\Protobuf\Internal\RepeatedField $start_times - * @type array|\Google\Protobuf\Internal\RepeatedField $service_dates - * @type array<\Google\Transit\Realtime\TripModifications\Modification>|\Google\Protobuf\Internal\RepeatedField $modifications + * @type \Google\Transit\Realtime\TripModifications\SelectedTrips[] $selected_trips + * @type string[] $start_times + * @type string[] $service_dates + * @type \Google\Transit\Realtime\TripModifications\Modification[] $modifications * } */ public function __construct($data = NULL) { @@ -51,7 +52,7 @@ public function __construct($data = NULL) { /** * Generated from protobuf field repeated .transit_realtime.TripModifications.SelectedTrips selected_trips = 1; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\TripModifications\SelectedTrips> */ public function getSelectedTrips() { @@ -60,10 +61,10 @@ public function getSelectedTrips() /** * Generated from protobuf field repeated .transit_realtime.TripModifications.SelectedTrips selected_trips = 1; - * @param array<\Google\Transit\Realtime\TripModifications\SelectedTrips>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\TripModifications\SelectedTrips[] $var * @return $this */ - public function setSelectedTrips($var) + public function setSelectedTrips(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TripModifications\SelectedTrips::class); $this->selected_trips = $arr; @@ -73,7 +74,7 @@ public function setSelectedTrips($var) /** * Generated from protobuf field repeated string start_times = 2; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField */ public function getStartTimes() { @@ -82,10 +83,10 @@ public function getStartTimes() /** * Generated from protobuf field repeated string start_times = 2; - * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @param string[] $var * @return $this */ - public function setStartTimes($var) + public function setStartTimes(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->start_times = $arr; @@ -95,7 +96,7 @@ public function setStartTimes($var) /** * Generated from protobuf field repeated string service_dates = 3; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField */ public function getServiceDates() { @@ -104,10 +105,10 @@ public function getServiceDates() /** * Generated from protobuf field repeated string service_dates = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @param string[] $var * @return $this */ - public function setServiceDates($var) + public function setServiceDates(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->service_dates = $arr; @@ -117,7 +118,7 @@ public function setServiceDates($var) /** * Generated from protobuf field repeated .transit_realtime.TripModifications.Modification modifications = 4; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\TripModifications\Modification> */ public function getModifications() { @@ -126,10 +127,10 @@ public function getModifications() /** * Generated from protobuf field repeated .transit_realtime.TripModifications.Modification modifications = 4; - * @param array<\Google\Transit\Realtime\TripModifications\Modification>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\TripModifications\Modification[] $var * @return $this */ - public function setModifications($var) + public function setModifications(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TripModifications\Modification::class); $this->modifications = $arr; diff --git a/src/Google/Transit/Realtime/TripModifications/Modification.php b/src/Google/Transit/Realtime/TripModifications/Modification.php index c7fab12..2edb8b2 100644 --- a/src/Google/Transit/Realtime/TripModifications/Modification.php +++ b/src/Google/Transit/Realtime/TripModifications/Modification.php @@ -1,12 +1,13 @@ transit_realtime.TripModifications.Modification @@ -47,7 +48,7 @@ class Modification extends \Google\Protobuf\Internal\Message * @type \Google\Transit\Realtime\StopSelector $start_stop_selector * @type \Google\Transit\Realtime\StopSelector $end_stop_selector * @type int $propagated_modification_delay - * @type array<\Google\Transit\Realtime\ReplacementStop>|\Google\Protobuf\Internal\RepeatedField $replacement_stops + * @type \Google\Transit\Realtime\ReplacementStop[] $replacement_stops * @type string $service_alert_id * @type int|string $last_modified_time * } @@ -81,9 +82,8 @@ public function clearStartStopSelector() * @param \Google\Transit\Realtime\StopSelector $var * @return $this */ - public function setStartStopSelector($var) + public function setStartStopSelector(\Google\Transit\Realtime\StopSelector|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\StopSelector::class); $this->start_stop_selector = $var; return $this; @@ -113,9 +113,8 @@ public function clearEndStopSelector() * @param \Google\Transit\Realtime\StopSelector $var * @return $this */ - public function setEndStopSelector($var) + public function setEndStopSelector(\Google\Transit\Realtime\StopSelector|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\StopSelector::class); $this->end_stop_selector = $var; return $this; @@ -135,7 +134,7 @@ public function getPropagatedModificationDelay() * @param int $var * @return $this */ - public function setPropagatedModificationDelay($var) + public function setPropagatedModificationDelay(int $var) { GPBUtil::checkInt32($var); $this->propagated_modification_delay = $var; @@ -145,7 +144,7 @@ public function setPropagatedModificationDelay($var) /** * Generated from protobuf field repeated .transit_realtime.ReplacementStop replacement_stops = 4; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\ReplacementStop> */ public function getReplacementStops() { @@ -154,10 +153,10 @@ public function getReplacementStops() /** * Generated from protobuf field repeated .transit_realtime.ReplacementStop replacement_stops = 4; - * @param array<\Google\Transit\Realtime\ReplacementStop>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\ReplacementStop[] $var * @return $this */ - public function setReplacementStops($var) + public function setReplacementStops(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\ReplacementStop::class); $this->replacement_stops = $arr; @@ -179,9 +178,9 @@ public function getServiceAlertId() * @param string $var * @return $this */ - public function setServiceAlertId($var) + public function setServiceAlertId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->service_alert_id = $var; return $this; @@ -201,7 +200,7 @@ public function getLastModifiedTime() * @param int|string $var * @return $this */ - public function setLastModifiedTime($var) + public function setLastModifiedTime(int|string $var) { GPBUtil::checkUint64($var); $this->last_modified_time = $var; @@ -211,6 +210,3 @@ public function setLastModifiedTime($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Modification::class, \Google\Transit\Realtime\TripModifications_Modification::class); - diff --git a/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php b/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php index 294df68..9cc50d2 100644 --- a/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php +++ b/src/Google/Transit/Realtime/TripModifications/SelectedTrips.php @@ -1,12 +1,13 @@ transit_realtime.TripModifications.SelectedTrips @@ -28,7 +29,7 @@ class SelectedTrips extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type array|\Google\Protobuf\Internal\RepeatedField $trip_ids + * @type string[] $trip_ids * @type string $shape_id * } */ @@ -39,7 +40,7 @@ public function __construct($data = NULL) { /** * Generated from protobuf field repeated string trip_ids = 1; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField */ public function getTripIds() { @@ -48,10 +49,10 @@ public function getTripIds() /** * Generated from protobuf field repeated string trip_ids = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @param string[] $var * @return $this */ - public function setTripIds($var) + public function setTripIds(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->trip_ids = $arr; @@ -73,9 +74,9 @@ public function getShapeId() * @param string $var * @return $this */ - public function setShapeId($var) + public function setShapeId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->shape_id = $var; return $this; @@ -83,6 +84,3 @@ public function setShapeId($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(SelectedTrips::class, \Google\Transit\Realtime\TripModifications_SelectedTrips::class); - diff --git a/src/Google/Transit/Realtime/TripModifications_Modification.php b/src/Google/Transit/Realtime/TripModifications_Modification.php deleted file mode 100644 index 60bc132..0000000 --- a/src/Google/Transit/Realtime/TripModifications_Modification.php +++ /dev/null @@ -1,16 +0,0 @@ -|\Google\Protobuf\Internal\RepeatedField $stop_time_update + * @type \Google\Transit\Realtime\TripUpdate\StopTimeUpdate[] $stop_time_update * @type int|string $timestamp * @type int $delay * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. @@ -86,9 +87,8 @@ public function clearTrip() * @param \Google\Transit\Realtime\TripDescriptor $var * @return $this */ - public function setTrip($var) + public function setTrip(\Google\Transit\Realtime\TripDescriptor|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor::class); $this->trip = $var; return $this; @@ -118,9 +118,8 @@ public function clearVehicle() * @param \Google\Transit\Realtime\VehicleDescriptor $var * @return $this */ - public function setVehicle($var) + public function setVehicle(\Google\Transit\Realtime\VehicleDescriptor|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\VehicleDescriptor::class); $this->vehicle = $var; return $this; @@ -128,7 +127,7 @@ public function setVehicle($var) /** * Generated from protobuf field repeated .transit_realtime.TripUpdate.StopTimeUpdate stop_time_update = 2; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\TripUpdate\StopTimeUpdate> */ public function getStopTimeUpdate() { @@ -137,10 +136,10 @@ public function getStopTimeUpdate() /** * Generated from protobuf field repeated .transit_realtime.TripUpdate.StopTimeUpdate stop_time_update = 2; - * @param array<\Google\Transit\Realtime\TripUpdate\StopTimeUpdate>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\TripUpdate\StopTimeUpdate[] $var * @return $this */ - public function setStopTimeUpdate($var) + public function setStopTimeUpdate(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate::class); $this->stop_time_update = $arr; @@ -162,7 +161,7 @@ public function getTimestamp() * @param int|string $var * @return $this */ - public function setTimestamp($var) + public function setTimestamp(int|string $var) { GPBUtil::checkUint64($var); $this->timestamp = $var; @@ -188,7 +187,7 @@ public function getDelay() * @param int $var * @return $this */ - public function setDelay($var) + public function setDelay(int $var) { GPBUtil::checkInt32($var); $this->delay = $var; @@ -220,9 +219,8 @@ public function clearTripProperties() * @param \Google\Transit\Realtime\TripUpdate\TripProperties $var * @return $this */ - public function setTripProperties($var) + public function setTripProperties(\Google\Transit\Realtime\TripUpdate\TripProperties|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\TripProperties::class); $this->trip_properties = $var; return $this; diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php index 481d8ff..973dae3 100644 --- a/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php @@ -1,12 +1,13 @@ transit_realtime.TripUpdate.StopTimeEvent @@ -64,7 +65,7 @@ public function getDelay() * @param int $var * @return $this */ - public function setDelay($var) + public function setDelay(int $var) { GPBUtil::checkInt32($var); $this->delay = $var; @@ -86,7 +87,7 @@ public function getTime() * @param int|string $var * @return $this */ - public function setTime($var) + public function setTime(int|string $var) { GPBUtil::checkInt64($var); $this->time = $var; @@ -108,7 +109,7 @@ public function getUncertainty() * @param int $var * @return $this */ - public function setUncertainty($var) + public function setUncertainty(int $var) { GPBUtil::checkInt32($var); $this->uncertainty = $var; @@ -134,7 +135,7 @@ public function getScheduledTime() * @param int|string $var * @return $this */ - public function setScheduledTime($var) + public function setScheduledTime(int|string $var) { GPBUtil::checkInt64($var); $this->scheduled_time = $var; @@ -144,6 +145,3 @@ public function setScheduledTime($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(StopTimeEvent::class, \Google\Transit\Realtime\TripUpdate_StopTimeEvent::class); - diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php index a2f12c5..6648238 100644 --- a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php @@ -1,12 +1,13 @@ transit_realtime.TripUpdate.StopTimeUpdate @@ -79,7 +80,7 @@ public function getStopSequence() * @param int $var * @return $this */ - public function setStopSequence($var) + public function setStopSequence(int $var) { GPBUtil::checkUint32($var); $this->stop_sequence = $var; @@ -101,9 +102,9 @@ public function getStopId() * @param string $var * @return $this */ - public function setStopId($var) + public function setStopId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_id = $var; return $this; @@ -133,9 +134,8 @@ public function clearArrival() * @param \Google\Transit\Realtime\TripUpdate\StopTimeEvent $var * @return $this */ - public function setArrival($var) + public function setArrival(\Google\Transit\Realtime\TripUpdate\StopTimeEvent|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\StopTimeEvent::class); $this->arrival = $var; return $this; @@ -165,9 +165,8 @@ public function clearDeparture() * @param \Google\Transit\Realtime\TripUpdate\StopTimeEvent $var * @return $this */ - public function setDeparture($var) + public function setDeparture(\Google\Transit\Realtime\TripUpdate\StopTimeEvent|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\StopTimeEvent::class); $this->departure = $var; return $this; @@ -175,7 +174,7 @@ public function setDeparture($var) /** * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus departure_occupancy_status = 7; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\VehiclePosition\OccupancyStatus} */ public function getDepartureOccupancyStatus() { @@ -184,10 +183,10 @@ public function getDepartureOccupancyStatus() /** * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus departure_occupancy_status = 7; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\VehiclePosition\OccupancyStatus} * @return $this */ - public function setDepartureOccupancyStatus($var) + public function setDepartureOccupancyStatus(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\OccupancyStatus::class); $this->departure_occupancy_status = $var; @@ -197,7 +196,7 @@ public function setDepartureOccupancyStatus($var) /** * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship schedule_relationship = 5; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship} */ public function getScheduleRelationship() { @@ -206,10 +205,10 @@ public function getScheduleRelationship() /** * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship schedule_relationship = 5; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship} * @return $this */ - public function setScheduleRelationship($var) + public function setScheduleRelationship(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship::class); $this->schedule_relationship = $var; @@ -245,9 +244,8 @@ public function clearStopTimeProperties() * @param \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties $var * @return $this */ - public function setStopTimeProperties($var) + public function setStopTimeProperties(\Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties::class); $this->stop_time_properties = $var; return $this; @@ -255,6 +253,3 @@ public function setStopTimeProperties($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(StopTimeUpdate::class, \Google\Transit\Realtime\TripUpdate_StopTimeUpdate::class); - diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php index ca358e2..4c79ecd 100644 --- a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php @@ -1,6 +1,7 @@ assigned_stop_id = $var; return $this; @@ -98,9 +99,9 @@ public function getStopHeadsign() * @param string $var * @return $this */ - public function setStopHeadsign($var) + public function setStopHeadsign(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_headsign = $var; return $this; @@ -110,7 +111,7 @@ public function setStopHeadsign($var) * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. * * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType pickup_type = 3; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType} */ public function getPickupType() { @@ -121,10 +122,10 @@ public function getPickupType() * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. * * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType pickup_type = 3; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType} * @return $this */ - public function setPickupType($var) + public function setPickupType(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType::class); $this->pickup_type = $var; @@ -136,7 +137,7 @@ public function setPickupType($var) * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. * * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType drop_off_type = 4; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType} */ public function getDropOffType() { @@ -147,10 +148,10 @@ public function getDropOffType() * NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. * * Generated from protobuf field .transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.DropOffPickupType drop_off_type = 4; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType} * @return $this */ - public function setDropOffType($var) + public function setDropOffType(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\TripUpdate\StopTimeUpdate\StopTimeProperties\DropOffPickupType::class); $this->drop_off_type = $var; @@ -160,6 +161,3 @@ public function setDropOffType($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(StopTimeProperties::class, \Google\Transit\Realtime\TripUpdate_StopTimeUpdate_StopTimeProperties::class); - diff --git a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php index e1e4fd6..5a8a9f9 100644 --- a/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php +++ b/src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php @@ -1,6 +1,7 @@ trip_id = $var; return $this; @@ -101,9 +102,9 @@ public function getStartDate() * @param string $var * @return $this */ - public function setStartDate($var) + public function setStartDate(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->start_date = $var; return $this; @@ -123,9 +124,9 @@ public function getStartTime() * @param string $var * @return $this */ - public function setStartTime($var) + public function setStartTime(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->start_time = $var; return $this; @@ -145,9 +146,9 @@ public function getShapeId() * @param string $var * @return $this */ - public function setShapeId($var) + public function setShapeId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->shape_id = $var; return $this; @@ -171,9 +172,9 @@ public function getTripHeadsign() * @param string $var * @return $this */ - public function setTripHeadsign($var) + public function setTripHeadsign(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->trip_headsign = $var; return $this; @@ -197,9 +198,9 @@ public function getTripShortName() * @param string $var * @return $this */ - public function setTripShortName($var) + public function setTripShortName(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->trip_short_name = $var; return $this; @@ -207,6 +208,3 @@ public function setTripShortName($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(TripProperties::class, \Google\Transit\Realtime\TripUpdate_TripProperties::class); - diff --git a/src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php b/src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php deleted file mode 100644 index 2c34cf4..0000000 --- a/src/Google/Transit/Realtime/TripUpdate_StopTimeEvent.php +++ /dev/null @@ -1,16 +0,0 @@ -id = $var; return $this; @@ -85,9 +86,9 @@ public function getLabel() * @param string $var * @return $this */ - public function setLabel($var) + public function setLabel(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->label = $var; return $this; @@ -107,9 +108,9 @@ public function getLicensePlate() * @param string $var * @return $this */ - public function setLicensePlate($var) + public function setLicensePlate(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->license_plate = $var; return $this; @@ -117,7 +118,7 @@ public function setLicensePlate($var) /** * Generated from protobuf field .transit_realtime.VehicleDescriptor.WheelchairAccessible wheelchair_accessible = 4; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\VehicleDescriptor\WheelchairAccessible} */ public function getWheelchairAccessible() { @@ -126,10 +127,10 @@ public function getWheelchairAccessible() /** * Generated from protobuf field .transit_realtime.VehicleDescriptor.WheelchairAccessible wheelchair_accessible = 4; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\VehicleDescriptor\WheelchairAccessible} * @return $this */ - public function setWheelchairAccessible($var) + public function setWheelchairAccessible(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehicleDescriptor\WheelchairAccessible::class); $this->wheelchair_accessible = $var; diff --git a/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php b/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php index 7340de4..142fd80 100644 --- a/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php +++ b/src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php @@ -1,6 +1,7 @@ |\Google\Protobuf\Internal\RepeatedField $multi_carriage_details + * @type \Google\Transit\Realtime\VehiclePosition\CarriageDetails[] $multi_carriage_details * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. * } */ @@ -114,9 +115,8 @@ public function clearTrip() * @param \Google\Transit\Realtime\TripDescriptor $var * @return $this */ - public function setTrip($var) + public function setTrip(\Google\Transit\Realtime\TripDescriptor|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\TripDescriptor::class); $this->trip = $var; return $this; @@ -146,9 +146,8 @@ public function clearVehicle() * @param \Google\Transit\Realtime\VehicleDescriptor $var * @return $this */ - public function setVehicle($var) + public function setVehicle(\Google\Transit\Realtime\VehicleDescriptor|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\VehicleDescriptor::class); $this->vehicle = $var; return $this; @@ -178,9 +177,8 @@ public function clearPosition() * @param \Google\Transit\Realtime\Position $var * @return $this */ - public function setPosition($var) + public function setPosition(\Google\Transit\Realtime\Position|null $var) { - GPBUtil::checkMessage($var, \Google\Transit\Realtime\Position::class); $this->position = $var; return $this; @@ -200,7 +198,7 @@ public function getCurrentStopSequence() * @param int $var * @return $this */ - public function setCurrentStopSequence($var) + public function setCurrentStopSequence(int $var) { GPBUtil::checkUint32($var); $this->current_stop_sequence = $var; @@ -222,9 +220,9 @@ public function getStopId() * @param string $var * @return $this */ - public function setStopId($var) + public function setStopId(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->stop_id = $var; return $this; @@ -232,7 +230,7 @@ public function setStopId($var) /** * Generated from protobuf field .transit_realtime.VehiclePosition.VehicleStopStatus current_status = 4; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\VehiclePosition\VehicleStopStatus} */ public function getCurrentStatus() { @@ -241,10 +239,10 @@ public function getCurrentStatus() /** * Generated from protobuf field .transit_realtime.VehiclePosition.VehicleStopStatus current_status = 4; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\VehiclePosition\VehicleStopStatus} * @return $this */ - public function setCurrentStatus($var) + public function setCurrentStatus(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\VehicleStopStatus::class); $this->current_status = $var; @@ -266,7 +264,7 @@ public function getTimestamp() * @param int|string $var * @return $this */ - public function setTimestamp($var) + public function setTimestamp(int|string $var) { GPBUtil::checkUint64($var); $this->timestamp = $var; @@ -276,7 +274,7 @@ public function setTimestamp($var) /** * Generated from protobuf field .transit_realtime.VehiclePosition.CongestionLevel congestion_level = 6; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\VehiclePosition\CongestionLevel} */ public function getCongestionLevel() { @@ -285,10 +283,10 @@ public function getCongestionLevel() /** * Generated from protobuf field .transit_realtime.VehiclePosition.CongestionLevel congestion_level = 6; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\VehiclePosition\CongestionLevel} * @return $this */ - public function setCongestionLevel($var) + public function setCongestionLevel(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\CongestionLevel::class); $this->congestion_level = $var; @@ -298,7 +296,7 @@ public function setCongestionLevel($var) /** * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 9; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\VehiclePosition\OccupancyStatus} */ public function getOccupancyStatus() { @@ -307,10 +305,10 @@ public function getOccupancyStatus() /** * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 9; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\VehiclePosition\OccupancyStatus} * @return $this */ - public function setOccupancyStatus($var) + public function setOccupancyStatus(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\OccupancyStatus::class); $this->occupancy_status = $var; @@ -336,7 +334,7 @@ public function getOccupancyPercentage() * @param int $var * @return $this */ - public function setOccupancyPercentage($var) + public function setOccupancyPercentage(int $var) { GPBUtil::checkUint32($var); $this->occupancy_percentage = $var; @@ -348,7 +346,7 @@ public function setOccupancyPercentage($var) * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. * * Generated from protobuf field repeated .transit_realtime.VehiclePosition.CarriageDetails multi_carriage_details = 11; - * @return \Google\Protobuf\Internal\RepeatedField + * @return RepeatedField<\Google\Transit\Realtime\VehiclePosition\CarriageDetails> */ public function getMultiCarriageDetails() { @@ -359,10 +357,10 @@ public function getMultiCarriageDetails() * NOTE: This message/field is still experimental, and subject to change. It may be formally adopted in the future. * * Generated from protobuf field repeated .transit_realtime.VehiclePosition.CarriageDetails multi_carriage_details = 11; - * @param array<\Google\Transit\Realtime\VehiclePosition\CarriageDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Transit\Realtime\VehiclePosition\CarriageDetails[] $var * @return $this */ - public function setMultiCarriageDetails($var) + public function setMultiCarriageDetails(array|RepeatedField $var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Transit\Realtime\VehiclePosition\CarriageDetails::class); $this->multi_carriage_details = $arr; diff --git a/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php b/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php index 2c168a7..675ec81 100644 --- a/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php +++ b/src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php @@ -1,12 +1,13 @@ id = $var; return $this; @@ -90,9 +91,9 @@ public function getLabel() * @param string $var * @return $this */ - public function setLabel($var) + public function setLabel(string $var) { - GPBUtil::checkString($var, True); + GPBUtil::checkString($var, true); $this->label = $var; return $this; @@ -100,7 +101,7 @@ public function setLabel($var) /** * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 3; - * @return int + * @return int one of the values in {@see \Google\Transit\Realtime\VehiclePosition\OccupancyStatus} */ public function getOccupancyStatus() { @@ -109,10 +110,10 @@ public function getOccupancyStatus() /** * Generated from protobuf field .transit_realtime.VehiclePosition.OccupancyStatus occupancy_status = 3; - * @param int $var + * @param int $var one of the values in {@see \Google\Transit\Realtime\VehiclePosition\OccupancyStatus} * @return $this */ - public function setOccupancyStatus($var) + public function setOccupancyStatus(int $var) { GPBUtil::checkEnum($var, \Google\Transit\Realtime\VehiclePosition\OccupancyStatus::class); $this->occupancy_status = $var; @@ -134,7 +135,7 @@ public function getOccupancyPercentage() * @param int $var * @return $this */ - public function setOccupancyPercentage($var) + public function setOccupancyPercentage(int $var) { GPBUtil::checkInt32($var); $this->occupancy_percentage = $var; @@ -156,7 +157,7 @@ public function getCarriageSequence() * @param int $var * @return $this */ - public function setCarriageSequence($var) + public function setCarriageSequence(int $var) { GPBUtil::checkUint32($var); $this->carriage_sequence = $var; @@ -166,6 +167,3 @@ public function setCarriageSequence($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(CarriageDetails::class, \Google\Transit\Realtime\VehiclePosition_CarriageDetails::class); - diff --git a/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php b/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php index 42dae60..db16770 100644 --- a/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php +++ b/src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php @@ -1,6 +1,7 @@ Date: Sat, 28 Mar 2026 03:08:51 +0000 Subject: [PATCH 4/5] ci: add mandatory PHPUnit tests workflow for master branch protection Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/1a0fcd1e-d612-4b56-8a0f-685a18b704ca Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com> --- .github/workflows/tests.yml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d664331 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: Tests + +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + +jobs: + tests: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + permissions: + contents: read + + strategy: + fail-fast: false + matrix: + php: + - '8.4' + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer + coverage: none + + - name: Install Composer dependencies + run: composer install --no-interaction --prefer-dist --no-progress + + - name: Run PHPUnit tests + run: vendor/bin/phpunit From 4af14b9090e04dace5d37e20bd8ab02735dc8a86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 03:09:06 +0000 Subject: [PATCH 5/5] chore: add FUNDING.yml with GitHub Sponsors, Buy Me a Coffee, and PayPal Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/1a0fcd1e-d612-4b56-8a0f-685a18b704ca Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com> --- .github/FUNDING.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..64e7cf6 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: dacoto +buy_me_a_coffee: dacoto +custom: ["https://www.paypal.com/donate/?hosted_button_id=SGZ2VZ52ZD378"]