Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement Coordinates by Location Name endpoint#189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
settermjd wants to merge4 commits intocmfcmf:main
base:main
Choose a base branch
Loading
fromsettermjd:implement-get-coordinates-by-location-name-endpoint

Conversation

settermjd
Copy link

This PR implements theCoordinates by Location Name endpoint.

While working through the API docs and the library's documentation, I didn't see anything that queried this endpoint. Given that, and I was in need of it, I created this PR.

This package is required, largely for testing, so that Guzzle requestscan be mocked instead of making live calls to the API.
This is a simplistic implementation of the endpoint. It's not complete,yet, but it's a start. Its implementation is required to implement theone call API endpoint.
I didn't look deeply enough at Location previously to realise that Cityalready extended it. Given that, this change effectively reverts theprevious refactor of Location to put the changes where they should be,on City.
As the method's private, it can't be tested directly. However, that'snot to say that it cannot be tested. So this test does that to ensurethat the URL it returns is always correct.
Copy link
Owner

@cmfcmfcmfcmf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for this PR, I left a few comments.

Comment on lines +288 to +291
$handlerStack = HandlerStack::create($mock);
$httpClient = new Client(
new GuzzleClient(['handler' => $handlerStack])
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you useTestHttpClient from the tests folder instead of introducing a new dependency?

Comment on lines +692 to +702
$cities[] = new City(
-1,
$datum->name,
$datum->lat,
$datum->lon,
$datum->country,
null,
null,
$datum->state,
(array)$datum->local_names
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you create a newCity class specifically for this API call? I don't like how the newly added fields are only used by this API, and how this API never sets some of the fields. Maybe call itLocation?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@cmfcmfcmfcmfcmfcmf requested changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@settermjd@cmfcmf

[8]ページ先頭

©2009-2025 Movatter.jp