private function getItemFile(core_kernel_classes_Resource $item, $type, $countryCode, $langCode, core_kernel_classes_Resource $user = null) { $returnValue = null; if (!isset($this->properties[TranslationProcessHelper::getPropertyName($type, $countryCode, $langCode)])) { $this->fail("The item property does not exist for the item {$item->getLabel()} ({$item->getUri()}) : {$type}, {$countryCode}, {$langCode} "); return $returnValue; } $file = null; if (in_array(strtolower($type), array('xliff_working', 'vff_working'))) { if (is_null($user)) { $this->fail('no user given'); return $returnValue; } $values = $item->getPropertyValues($this->properties[TranslationProcessHelper::getPropertyName($type, $countryCode, $langCode)]); foreach ($values as $uri) { if (common_Utils::isUri($uri)) { $aFile = new core_kernel_versioning_File($uri); $assignedUser = $aFile->getUniquePropertyValue($this->userProperty); if ($assignedUser->getUri() == $user->getUri()) { $file = $aFile; break; } } } } else { $values = $item->getPropertyValues($this->properties[TranslationProcessHelper::getPropertyName($type, $countryCode, $langCode)]); $this->assertEqual(count($values), 1); $file = new core_kernel_versioning_File(reset($values)); } if (!is_null($file) && $file->isVersioned()) { $returnValue = $file; } else { $this->fail("Cannot get the versioned {$type} file in {$countryCode}_{$langCode} for the item {$item->getLabel()} ({$item->getUri()})"); } return $returnValue; }