amadeus4dev-examples / amadeus-php Goto Github PK
View Code? Open in Web Editor NEWPHP library for the Amadeus Self-Service APIs
Home Page: https://amadeus4dev-examples.github.io/amadeus-php/
License: MIT License
PHP library for the Amadeus Self-Service APIs
Home Page: https://amadeus4dev-examples.github.io/amadeus-php/
License: MIT License
/src/client/Response.php
Local variables should not have the same name as class fields
https://github.com/amadeus4dev/amadeus-php/blob/32d6cffa5009ef8e3665e9703cca6e52554d8a68/src/client/Response.php#L41
https://github.com/amadeus4dev/amadeus-php/blob/32d6cffa5009ef8e3665e9703cca6e52554d8a68/src/client/Response.php#L195
Collapsible "if" statements should be merged
https://github.com/amadeus4dev/amadeus-php/blob/32d6cffa5009ef8e3665e9703cca6e52554d8a68/src/client/Response.php#L199-L201
/src/exceptions/
/src/exceptions/AuthenticationException.php
While trying to read allowance weight for traveler, the infants has no weight information.
But when calling getIncludedCheckedBags() method it's throw an exception.
TypeError
Amadeus\Resources\Resource::toResourceObject(): Argument #1 ($object) must be of type object, null given, called in /Users/abdullahishtiwy/Sites/booking-core/vendor/amadeus4dev/amadeus-php/src/resources/FlightFareDetailsBySegment.php on line 98.
and there is no way to check if it has a data or not.
https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-list/api-reference
@jabrena @tsolakoua @minjikarin hey, although I saw the warning that the Amadeus for Developers team will not support or maintain this SDK, however, since this repo has been transferred to another organization, which means the URL for the PHP documentation should be changed too. Thus, please set up GitHub pages for this repo to make the documentation link works again. (Cuz only the admin user of this organization can set up GitHub pages so I can't contribute to it, you can see more details here)
Line 136 in 2f09497
https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking/api-reference
Hello @jabrena @tsolakoua @minjikarin
The following is The SonarCloud analysis result after merging PR #80 #82 #84:
Code smells counts: from 65 to 41
Duplication: from 1.3% to 1.2%
However, there are still some code smells that I think we can resolve by choosing won't fix
.
Thus, please review it (could have a preview from my repo, see details here) and it would be great if we can schedule a meeting to review it together :)
1. /tests/client/
HTTPClientTest.php
RequestTest.php
ResponseTest.php
String literals should not be duplicated
e.g. Define a constant instead of duplicating this literal "foo: bar" 3 times.
https://github.com/amadeus4dev/amadeus-php/blob/324073f3ea3a57499b5bb0a15addfdce2f30eb95/tests/client/HTTPClientTest.php#L61-L62
https://github.com/amadeus4dev/amadeus-php/blob/324073f3ea3a57499b5bb0a15addfdce2f30eb95/tests/client/HTTPClientTest.php#L342
https://github.com/amadeus4dev/amadeus-php/blob/324073f3ea3a57499b5bb0a15addfdce2f30eb95/tests/client/HTTPClientTest.php#L347
Local variables should not have the same name as class fields
e.g. Rename "$params" which has the same name as the field declared at line 40.
https://github.com/amadeus4dev/amadeus-php/blob/324073f3ea3a57499b5bb0a15addfdce2f30eb95/tests/client/HTTPClientTest.php#L40
https://github.com/amadeus4dev/amadeus-php/blob/324073f3ea3a57499b5bb0a15addfdce2f30eb95/tests/client/HTTPClientTest.php#L174
Track uses of "TODO" tags
2. /tests/exceptions/
ExceptionsTest.php
3. /tests/.../
(Endpoints)
HotelBookingsTest.php
Covid19AreaReportTest.php
HotelOfferTest.php
FlightAvailabilitiesTest.php
String literals should not be duplicated
Source files should not have any duplicated blocks
Functions should not have too many lines of code
e.g. This function "test_given_client_when_call_hotel_offer_then_ok" has 227 lines, which is greater than the 150 lines authorized. Split it into smaller functions.
https://github.com/amadeus4dev/amadeus-php/blob/324073f3ea3a57499b5bb0a15addfdce2f30eb95/tests/shopping/HotelOfferTest.php#L87-L371
for API that supports selecting a resource by ID, the way should be passing the ID into the singular path.
For example, GET /v2/shopping/hotel-offers/XXX should be:
$amadeus->getShopping().getHotelOffer("XXX")->get();
since the raw response might contain meta
, warning
, dictionaries
and so on.
it would be better to provide an easy way to get these data from response,
the idea would be like the following:
$response->getMeta();
$response->getDictionaries();
$response->getWarning();
$flightOffers = $this->amadeus->getShopping()->getFlightOffers()->get($data);
Expected Behavior: Expecting Amadeus FlightOffers data according to the API specification
Actual Behavior: Receiving partial data.
{
"data": [
{
"lastTicketingDateTime": "2023-06-05"
},
{
"lastTicketingDateTime": "2023-05-31"
},
{
"lastTicketingDateTime": "2023-05-31"
}
]
}
Request payload:
originLocationCode:SYD
destinationLocationCode:BYK
departureDate:2023-06-05
adults:1
max:10
Stable Behavior? It is consistently generating the same result every time
PHP version: 7.4.16
Laravel version: 8.75
postman: v10.14
amadeus-php version: 0.3.0
Airport & City Search API has two endpoints, the SDK doesn't include the one for
/reference-data/locations/{locationId}
The SDK client should accept the SDK credentials implicitly as environment variables AMADEUS_CLIENT_ID
and AMADEUS_CLIENT_SECRET
I will recommend using PHPDocumentor to generate the reference document of this SDK.
Thus, we need to fix and update some code commenting based on the generated document.
refer:
PHP Documentation Standards
The current tests are using @covers
effectively to filter the code coverage report to include only executed code from the referenced code parts. This is to ensure that code is only marked as covered if there are dedicated tests for it, but not if it is used indirectly by the tests for a different class, thus avoiding false positives for code coverage. ref
However, some of the tests which include an Amadeus object, need to cover all the namespaces inside the Amadeus, otherwise, there will be some risks in the coverage report.
Thus, the current tests need to be improved and decoupled for reducing the redundant @covers
annotations.
https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-search/api-reference
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.