Skip to content

Commit

Permalink
Fix Phan issue and improve uploads example
Browse files Browse the repository at this point in the history
  • Loading branch information
samwilson committed Dec 17, 2024
1 parent 70f4ff9 commit b5e9899
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 0 additions & 5 deletions .phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
'src/GroupsPoolsApi.php' => ['PhanUnextractableAnnotation'],
'src/InterestingnessApi.php' => ['PhanUnextractableAnnotation'],
'src/MachinetagsApi.php' => ['PhanUnextractableAnnotation'],
'src/Oauth/PhpFlickrService.php' => [
'PhanUndeclaredClass', 'PhanUndeclaredClassMethod', 'PhanUndeclaredExtendedClass',
'PhanUndeclaredMethod', 'PhanUndeclaredProperty', 'PhanUndeclaredTypeParameter',
'PhanUnreferencedUseNormal'
],
'src/PandaApi.php' => ['PhanUnextractableAnnotation'],
'src/PeopleApi.php' => ['PhanUnextractableAnnotation'],
'src/PhotosApi.php' => ['PhanTypeMismatchDefault', 'PhanTypeMismatchForeach', 'PhanUnextractableAnnotation'],
Expand Down
8 changes: 6 additions & 2 deletions examples/uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@
true,
true
);
$info = $phpFlickr->photos()->getInfo($result['photoid']);
echo "The new photo is: " . $info['urls']['url'][0]['_content'] . "\n";
if ($result['stat'] === 'fail') {
echo $result['message'] . "\n";
} else {
$info = $phpFlickr->photos()->getInfo($result['photoid']);
echo "The new photo is: " . $info['urls']['url'][0]['_content'] . "\n";
}
2 changes: 2 additions & 0 deletions src/Oauth/PhpFlickrService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use OAuth\Common\Storage\TokenStorageInterface;
use OAuth\OAuth1\Service\Flickr;
use OAuth\OAuth1\Signature\SignatureInterface;
use OAuth\OAuth1\Token\TokenInterface;

class PhpFlickrService extends Flickr
{
Expand Down Expand Up @@ -71,6 +72,7 @@ public function service()
public function getAuthorizationForPostingToAlternateUrl($args, $uri)
{
$token = $this->storage->retrieveAccessToken($this->service());
assert($token instanceof TokenInterface);
$this->signature->setTokenSecret($token->getAccessTokenSecret());
$authParameters = $this->getBasicAuthorizationHeaderInfo();
if (isset($authParameters['oauth_callback'])) {
Expand Down

0 comments on commit b5e9899

Please sign in to comment.