You are here

public function Project::getStatus in GatherContent 8

Same name and namespace in other branches
  1. 8.3 src/DAO/Project.php \Drupal\gathercontent\DAO\Project::getStatus()

Description.

Parameters

int $project_id: Project ID.

int $status_id: Status ID.

Return value

array Description.

File

src/DAO/Project.php, line 182

Class

Project

Namespace

Drupal\gathercontent\DAO

Code

public function getStatus($project_id, $status_id) {
  if (!$this->local) {
    try {
      $response = $this->client
        ->get('/projects/' . $project_id . '/statuses/' . $status_id);
      if ($response
        ->getStatusCode() === 200) {
        $data = json_decode($response
          ->getBody());
        return $data->data;
      }
    } catch (\Exception $e) {
      drupal_set_message($e
        ->getMessage(), 'error');
      \Drupal::logger('gathercontent')
        ->error($e
        ->getMessage(), array());
    }
  }
  else {
    drupal_set_message(t('Error occured, please contact your system administrator'), 'error');
    \Drupal::logger('gathercontent')
      ->alert('Object Project created as local, but trying to reach remote data.', []);
  }
}