for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Akeneo\Crowdin;
/**
* Reads a stream from the translation local file path
*
* @author Nicolas Dupont <[email protected]>
*/
class FileReader
{
* @param Translation $translation
* @return resource
public function readTranslation(Translation $translation)
return $this->readStream($translation->getLocalPath());
}
public function readStream($filename)
if (!file_exists($filename)) {
throw new FileNotFoundException(sprintf('The file "%s" does not exists.', $filename));
$stream = fopen($filename, 'r');
if (!$stream) {
throw new FileNotFoundException(sprintf('The file "%s" can\'t be opened.', $filename));
return $stream;