/**
  * When it's called, XML file is parsed (using parser set in $xmlParser)
  * or cache is loaded, if available.
  *
  * @return void
  */
 public function initializeObject()
 {
     if ($this->cache->has(md5($this->sourcePath))) {
         $this->xmlParsedData = $this->cache->get(md5($this->sourcePath));
     } else {
         $this->xmlParsedData = $this->xmlParser->getParsedData($this->sourcePath);
         $this->cache->set(md5($this->sourcePath), $this->xmlParsedData);
     }
 }
 /**
  * Read the xliff file and create the desired json
  *
  * @param string $xliffPathAndFilename The file to read
  * @param string $packageKey
  * @param string $sourceName
  * @return array
  *
  * @todo remove the override handling once Flow takes care of that, see FLOW-61
  */
 public function parseXliffToArray($xliffPathAndFilename, $packageKey, $sourceName)
 {
     /** @var array $parsedData */
     $parsedData = $this->xliffParser->getParsedData($xliffPathAndFilename);
     $arrayData = array();
     foreach ($parsedData['translationUnits'] as $key => $value) {
         $valueToStore = !empty($value[0]['target']) ? $value[0]['target'] : $value[0]['source'];
         if ($this->scrambleTranslatedLabels) {
             $valueToStore = str_repeat('#', UnicodeFunctions::strlen($valueToStore));
         }
         $this->setArrayDataValue($arrayData, str_replace('.', '_', $packageKey) . '.' . str_replace('/', '_', $sourceName) . '.' . str_replace('.', '_', $key), $valueToStore);
     }
     return $arrayData;
 }
 /**
  * Reads a particular Xliff file and returns it's translation units as array entries
  *
  * @param string the package key
  * @param string the source name (e.g. filename)
  * @param \TYPO3\Flow\I18n\Locale the locale
  *
  * @return array
  */
 protected function getXliffDataAsArray($packageKey, $sourceName, \TYPO3\Flow\I18n\Locale $locale)
 {
     $sourcePath = \TYPO3\Flow\Utility\Files::concatenatePaths(array('resource://' . $packageKey, 'Private/Translations'));
     list($sourcePath, $foundLocale) = $this->localizationService->getXliffFilenameAndPath($sourcePath, $sourceName, $locale);
     return $this->xliffParser->getParsedData($sourcePath);
 }