You are here

protected function LingotekApi::formatResponse in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  2. 4.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  3. 3.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  4. 3.1.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  5. 3.2.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  6. 3.3.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  7. 3.4.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  8. 3.5.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  9. 3.6.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  10. 3.7.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
  11. 3.8.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::formatResponse()
4 calls to LingotekApi::formatResponse()
LingotekApi::getCommunities in src/Remote/LingotekApi.php
LingotekApi::getProjects in src/Remote/LingotekApi.php
LingotekApi::getVaults in src/Remote/LingotekApi.php
LingotekApi::getWorkflows in src/Remote/LingotekApi.php

File

src/Remote/LingotekApi.php, line 361
Contains \Drupal\lingotek\Remote\LingotekApi.

Class

LingotekApi

Namespace

Drupal\lingotek\Remote

Code

protected function formatResponse($response) {
  $formatted_response = array();
  $json_response = json_decode($response
    ->getBody(), TRUE);
  if (!empty($json_response['entities'])) {
    foreach ($json_response['entities'] as $entity) {
      if (!empty($entity['properties']['id']) && !empty($entity['properties']['title'])) {
        $formatted_response[$entity['properties']['id']] = $entity['properties']['title'];
      }
    }
  }
  return $formatted_response;
}