function &createImportLanguageValidator($lang_file_data)
 {
     $dataReflector =& $this->reflectionFactory->createHashtableReflector($lang_file_data);
     $this->setDataReflector($dataReflector);
     $factoryReflector =& $this->reflectionFactory->createFactoryReflector($this);
     $batch = $this->generalValidationFactory->createValidatorBatch($dataReflector, $factoryReflector);
     $batch->add('languageId', 'LanguageNotExistsValidator', 'LANGUAGE_ALREADY_EXISTS');
     $batch->add('lang_file_path', 'LanguageFileValidator', 'LANGUAGE_FILE_IS_INVALID');
     return $batch;
 }
Esempio n. 2
0
 function phraseExists($phraseId, $domainId)
 {
     $domainExistsValidator = $this->translationValidatorFactory->createDomainExistsValidator();
     $dataReflector = $this->reflectionFactory->createConstantReflector($domainId);
     $phraseExistsValidator = $this->translationValidatorFactory->createPhraseExistsValidator();
     $phraseExistsValidator->setDataReflector($dataReflector);
     return $domainExistsValidator->isValid($domainId) && $phraseExistsValidator->isValid($phraseId);
 }
 /**
  * @param mixed $function
  */
 public function __construct($function)
 {
     $this->reflection = $function instanceof \ReflectionFunctionAbstract ? $function : ReflectionFactory::create($function);
 }