From 4f2cf82de51030c49fcc0b7e5530363211ac4649 Mon Sep 17 00:00:00 2001 From: Pierre Grimaud Date: Wed, 8 Jul 2020 22:47:50 +0200 Subject: [PATCH] Add 32bit arch support for medias #78 --- src/Instagram/Hydrator/ProfileHydrator.php | 1 + src/Instagram/Model/Profile.php | 21 +++++++++++++++++++ .../Transport/JsonMediasDataFeed.php | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Instagram/Hydrator/ProfileHydrator.php b/src/Instagram/Hydrator/ProfileHydrator.php index da48e07..ef731bd 100644 --- a/src/Instagram/Hydrator/ProfileHydrator.php +++ b/src/Instagram/Hydrator/ProfileHydrator.php @@ -35,6 +35,7 @@ public function __construct(Profile $instagramProfile = null) public function hydrateProfile(\StdClass $data): void { $this->profile->setId((int)$data->id); + $this->profile->setId32Bit($data->id); $this->profile->setUserName($data->username); $this->profile->setFullName($data->full_name); $this->profile->setBiography($data->biography); diff --git a/src/Instagram/Model/Profile.php b/src/Instagram/Model/Profile.php index 9fcf5e5..a3d7433 100644 --- a/src/Instagram/Model/Profile.php +++ b/src/Instagram/Model/Profile.php @@ -11,6 +11,11 @@ class Profile */ private $id; + /** + * @var string + */ + private $id32Bit; + /** * @var string */ @@ -338,4 +343,20 @@ public function __serialize(): array { return $this->toArray(); } + + /** + * @return string + */ + public function getId32Bit(): string + { + return $this->id32Bit; + } + + /** + * @param string $id32Bit + */ + public function setId32Bit(string $id32Bit): void + { + $this->id32Bit = $id32Bit; + } } diff --git a/src/Instagram/Transport/JsonMediasDataFeed.php b/src/Instagram/Transport/JsonMediasDataFeed.php index 7b07be8..df48b85 100644 --- a/src/Instagram/Transport/JsonMediasDataFeed.php +++ b/src/Instagram/Transport/JsonMediasDataFeed.php @@ -19,7 +19,7 @@ class JsonMediasDataFeed extends AbstractDataFeed public function fetchData(Profile $instagramProfile): \StdClass { $variables = [ - 'id' => $instagramProfile->getId(), + 'id' => PHP_INT_SIZE === 4 ? $instagramProfile->getId32Bit() : $instagramProfile->getId(), 'first' => InstagramHelper::PAGINATION_DEFAULT, 'after' => $instagramProfile->getEndCursor(), ];