Skip to content

Use ArrayAccessor in GenericResourceOwner#788

Closed
AndreiIgna wants to merge 5 commits intothephpleague:masterfrom
AndreiIgna:patch-1
Closed

Use ArrayAccessor in GenericResourceOwner#788
AndreiIgna wants to merge 5 commits intothephpleague:masterfrom
AndreiIgna:patch-1

Conversation

@AndreiIgna
Copy link
Copy Markdown

Allow the resourceOwnerId to be specified in more formats, like user.id.
This would enable the GenericProvider to be used with more OAuth APIs.

Slack, for example, returns the user info in a nested array https://api.slack.com/methods/users.identity#response

By accepting this PR, the Slack OAuth and others can be used with the GenericProvider.

Allow the `resourceOwnerId` to be specified in more formats, like `user.id`
@AndreiIgna
Copy link
Copy Markdown
Author

Second commit adds GenericResourceOwner::getAttribute() helper method, which makes it easier to access user data.

// at the moment
$userData = $resourceOwner->toArray();
$userField = $userData['field'];
$userField2 = $userData['group']['field'];

// with getAttribute() method
$userField = $resourceOwner->getAttribute('field');
$userField2 = $resourceOwner->getAttribute('group.field');

@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 28, 2020

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.57%. Comparing base (77def43) to head (1fb4158).
⚠️ Report is 113 commits behind head on master.

Files with missing lines Patch % Lines
src/Provider/GenericResourceOwner.php 33.33% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              master     #788      +/-   ##
=============================================
- Coverage     100.00%   99.57%   -0.43%     
- Complexity       180      181       +1     
=============================================
  Files             20       20              
  Lines            464      466       +2     
=============================================
  Hits             464      464              
- Misses             0        2       +2     
Files with missing lines Coverage Δ
src/Provider/GenericResourceOwner.php 77.77% <33.33%> (-22.23%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AndreiIgna AndreiIgna closed this by deleting the head repository Nov 29, 2025
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