You are here

public function Project::getStatuses in GatherContent 8.3

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

Description.

Parameters

int $project_id: Project ID.

Return value

array Description.

File

src/DAO/Project.php, line 153

Class

Project
Class Project.

Namespace

Drupal\gathercontent\DAO

Code

public function getStatuses($project_id) {
  if (!$this->local) {
    try {
      $response = $this->client
        ->get('/projects/' . $project_id . '/statuses');
      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(), []);
    }
  }
  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.', []);
  }
}