You are here

protected function BaseApiAbstract::readFile in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.2 api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::readFile()
  2. 8.2 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::readFile()
  3. 8.3 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::readFile()

OOP wrapper for fopen() function.

Parameters

string $realPath: Real path for file.

Return value

resource

Throws

\Smartling\Exceptions\SmartlingApiException

3 calls to BaseApiAbstract::readFile()
BatchApi::processBodyOptions in vendor/smartling/api-sdk-php/src/Batch/BatchApi.php
ContextApi::processBodyOptions in vendor/smartling/api-sdk-php/src/Context/ContextApi.php
FileApi::processBodyOptions in vendor/smartling/api-sdk-php/src/File/FileApi.php

File

vendor/smartling/api-sdk-php/src/BaseApiAbstract.php, line 271

Class

BaseApiAbstract
Class BaseApiAbstract

Namespace

Smartling

Code

protected function readFile($realPath) {
  $stream = @fopen($realPath, 'r');
  if (!$stream) {
    throw new SmartlingApiException("File {$realPath} was not able to be read.");
  }
  else {
    return $stream;
  }
}