Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting user information #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

kevinjon27
Copy link

No description provided.

@codecov-io
Copy link

codecov-io commented Oct 9, 2018

Codecov Report

Merging #4 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master      #4      +/-   ##
===========================================
- Coverage      3.53%   3.49%   -0.05%     
  Complexity      145     145              
===========================================
  Files            30      30              
  Lines           452     458       +6     
===========================================
  Hits             16      16              
- Misses          436     442       +6
Impacted Files Coverage Δ Complexity Δ
src/LineDriver.php 14.81% <0%> (-0.88%) 33 <0> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b5d90d...118f520. Read the comment docs.

@gundamew
Copy link
Owner

Could you add some test cases for split_name?

@kevinjon27
Copy link
Author

@gundamew like that bro?

], true);

$userInfo = json_decode($userInfoData->getContent(), true);
$names = self::split_name($userInfo['displayName']);
Copy link
Owner

Choose a reason for hiding this comment

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

https://developers.line.me/en/reference/messaging-api/#get-profile

I checked the response columns of LINE profile API. It only contains displayName and no other "name"s.

For reference, the user data returned from Telegram API. The last_name column is optional, so it is fine if user only set first name.

IMO maybe we don't have to split user names? Just display the value of displayName column.

Copy link
Author

Choose a reason for hiding this comment

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

Sure. just use displayName value as fist_name.


return new User($userId, $names['first_name'], $names['last_name'], null, $userInfo);
} catch (\Exception $e) {
return new User($userId);
Copy link
Owner

Choose a reason for hiding this comment

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

Uh, where the exception being thrown?

And IMO, the method should handle the exceptions, instead of just returning another User instance.

Copy link
Author

Choose a reason for hiding this comment

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

So I read https://github.com/botman/driver-slack/blob/master/src/SlackDriver.php and follow how they code the function. What do you think?

Copy link
Owner

Choose a reason for hiding this comment

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

https://github.com/botman/driver-slack/blob/master/src/SlackDriver.php#L386-L403

I had read the code of BotMan Facebook driver and Telegram driver but not Slack driver. It is interesting.

I got your point, but I still prefer to do things simple. If error happens, let it happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants