userManager->userExists($userId)) { return; } // update contacts with first available social media profile $result = $this->social->updateAddressbooks($userId, $offsetBook, $offsetContact); if ($result->getStatus() === Http::STATUS_PARTIAL_CONTENT) { // not finished; schedule a follow-up /** @var array $report */ $report = $result->getData(); $stoppedAtBook = $report[0]['stoppedAt']['addressBook']; $stoppedAtContact = $report[0]['stoppedAt']['contact']; // make sure the offset contact/address book are still existing if (!$this->social->existsAddressBook($stoppedAtBook, $userId)) { $stoppedAtBook = null; } if (!$this->social->existsContact($stoppedAtContact, $stoppedAtBook, $userId)) { $stoppedAtContact = null; } $this->jobList->add(self::class, [ 'userId' => $userId, 'offsetBook' => $stoppedAtBook, 'offsetContact' => $stoppedAtContact ]); } } }