/** * Download file * * @return string */ protected function downloadFile() { if (!isset($this->fileBody)) { if (in_array(substr($this->fileMode, 0, 1), array('r', 'c', 'a'))) { $httpClient = new GuzzleHttp\Client(); static::$service->getClient()->authorize($httpClient); $request = $httpClient->createRequest('GET', $this->file->getDownloadUrl()); $response = $httpClient->send($request); if ($response->getStatusCode() == 200) { $this->fileBody = $response->getBody(); } if ('a' == substr($this->fileMode, 0, 1)) { $this->filePosition = strlen($this->fileBody); } } else { $this->fileBody = ''; } } return $this->fileBody; }