psn-php
psn-php copied to clipboard
Invalid argument supplied for foreach on avatarUrl
Both avatarUrl
and avatarUrls
return this error Invalid argument supplied for foreach on line 160 in tustin/psn-php/src/Model/User.php
when using search()
on 3.0.
Could you provide some code?
The code seems to be working pretty fine.
Here are the code for avatars for a single user:
$username = 'psnuserhere';
$acc = $client->users()->search($username)->first()->accountId();
$user = $client->users()->find($acc);
var_dump($user->avatarUrls());
foreach ($user->avatarUrls() as $avatarUrl) {
echo $avatarUrl;
}
Or in case you are trying to search the users and get their avatars:
$searchTerm = 'psnuserhere'
$users = $client->users()->search($searchTerm );
foreach ($users as $user) {
var_dump($user->avatarUrls());
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.