You are here

protected function BaseApiAbstract::readFile in TMGMT Translator Smartling 8.2

Same name in this branch
  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()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::readFile()
  2. 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

File

api-sdk-php/src/BaseApiAbstract.php, line 250

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;
  }
}