Skip to content

Commit 6ce4273

Browse files
authored
Merge pull request #82 from Crizz0/iss/78
Remove function validateSearchSynonymsFile and validateSearchIgnoreWo…
2 parents 909160f + abc0d84 commit 6ce4273

File tree

12 files changed

+0
-227
lines changed

12 files changed

+0
-227
lines changed

src/Phpbb/TranslationValidator/Validator/FileValidator.php

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,6 @@ public function validate($sourceFile, $originFile)
252252
{
253253
$this->validateHelpFile($sourceFile, $originFile);
254254
}
255-
else if ($originFile == $this->originLanguagePath . 'search_synonyms.php')
256-
{
257-
$this->validateSearchSynonymsFile($originFile);
258-
}
259-
else if ($originFile == $this->originLanguagePath . 'search_ignore_words.php')
260-
{
261-
$this->validateSearchIgnoreWordsFile($originFile);
262-
}
263255
else if (substr($originFile, -4) === '.php')
264256
{
265257
$this->validateLangFile($sourceFile, $originFile);
@@ -589,95 +581,6 @@ public function validateHelpFile($sourceFile, $originFile)
589581
}
590582
}
591583

592-
/**
593-
* Validates the search_synonyms.php file
594-
*
595-
* Files must only contain the variable $synonyms.
596-
* This variable must be an array of string => string entries.
597-
*
598-
* @todo Check for template vars and html
599-
*
600-
* @param string $originFile File to validate
601-
* @return null
602-
*/
603-
public function validateSearchSynonymsFile($originFile)
604-
{
605-
$originFilePath = $this->originPath . '/' . $originFile;
606-
607-
if (!$this->safeMode)
608-
{
609-
/** @var $synonyms */
610-
include($originFilePath);
611-
612-
$defined_variables = get_defined_vars();
613-
if (sizeof($defined_variables) != 3 || !isset($defined_variables['synonyms']) || gettype($defined_variables['synonyms']) != 'array')
614-
{
615-
$this->output->addMessage(Output::FATAL, 'Must only contain the synonyms-array', $originFile);
616-
return;
617-
}
618-
}
619-
620-
else
621-
{
622-
/** @var $synonyms */
623-
$synonyms = ValidatorRunner::langParser($originFilePath);
624-
$this->output->addMessage(Output::NOTICE, '<bg=yellow;options=bold>[Safe Mode]</> Manually run the translation validator to check synonym variables.', $originFile);
625-
}
626-
627-
foreach ($synonyms as $synonym1 => $synonym2)
628-
{
629-
if (gettype($synonym1) != 'string' || gettype($synonym2) != 'string')
630-
{
631-
$this->output->addMessage(Output::FATAL, 'Must only contain entries of type string => string: ' . serialize($synonym1) . ' => ' . serialize($synonym2), $originFile);
632-
}
633-
}
634-
}
635-
636-
/**
637-
* Validates the search_ignore_words.php file
638-
*
639-
* Files must only contain the variable $words.
640-
* This variable must be an array of string entries.
641-
*
642-
* @todo Check for template vars and html
643-
*
644-
* @param string $originFile File to validate
645-
* @return null
646-
*/
647-
public function validateSearchIgnoreWordsFile($originFile)
648-
{
649-
$originFilePath = $this->originPath . '/' . $originFile;
650-
651-
if (!$this->safeMode)
652-
{
653-
/** @var $words */
654-
include($originFilePath);
655-
656-
$defined_variables = get_defined_vars();
657-
if (sizeof($defined_variables) != 3 || !isset($defined_variables['words']) || gettype($defined_variables['words']) != 'array')
658-
{
659-
$this->output->addMessage(Output::FATAL, 'Must only contain the words-array', $originFile);
660-
return;
661-
}
662-
}
663-
664-
else
665-
{
666-
/** @var $words */
667-
$words = ValidatorRunner::langParser($originFilePath);
668-
$this->output->addMessage(Output::NOTICE, '<bg=yellow;options=bold>[Safe Mode]</> Manually run the translation validator to check word variables.', $originFile);
669-
}
670-
671-
foreach ($words as $word)
672-
{
673-
if (gettype($word) != 'string')
674-
{
675-
//@todo use $i
676-
$this->output->addMessage(Output::FATAL, 'Must only contain entries of type string: ' . serialize($word), $originFile);
677-
}
678-
}
679-
}
680-
681584
/**
682585
* Validates the LICENSE file
683586
*

tests/FileValidator/ValidateSearchTest.php

Lines changed: 0 additions & 72 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_ignore_words/additional_variable.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_ignore_words/invalid_word.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_ignore_words/invalid_words.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_ignore_words/no_words.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_ignore_words/valid.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_synonyms/additional_variable.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_synonyms/invalid_synonym.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/FileValidator/fixtures/origin/search_synonyms/invalid_synonyms.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)