public static function setAnswers(array $answers)
 {
     self::$answers = $answers;
 }
 private function setParameters(array $config)
 {
     // checking we have all the mandatary fields
     $mandatoryConfigParams = array('input_handler_1', 'input_resource_1', 'input_handler_2', 'input_resource_2', 'output_generator', 'output_resource');
     foreach ($mandatoryConfigParams as $mandatoryConfigParam) {
         if (!array_key_exists($mandatoryConfigParam, $config)) {
             throw new Exception("The mandatory configuration field {$mandatoryConfigParam} is missing.");
         }
     }
     if ($config['enable_log'] && !$config['logger']) {
         throw new Exception("You need to specify the logger to use");
     }
     // @todo - creating of output class
     $this->inputHandler1name = $config['input_handler_1'];
     $this->inputHandler2name = $config['input_handler_2'];
     $this->outputGeneratorName = $config['output_generator'];
     $this->inputResource1 = $config['input_resource_1'];
     $this->inputResource2 = $config['input_resource_2'];
     $this->outputResource = $config['output_resource'];
     $this->ignoreTablesRegexp = $config['ignore_tables_regexp'];
     $this->enableLog = $config['enable_log'];
     $this->logger = $config['logger'];
     $this->disableUserInteraction = false;
     if (isset($config['disable_user_interaction']) && $config['disable_user_interaction']) {
         $this->disableUserInteraction = true;
     }
     if (isset($config['answers']) && strlen($config['answers']) > 0) {
         Nextgen_Core_UserInteraction::setAnswers(explode(',', $config['answers']));
     }
 }
 protected function getRenamedFieldsMapping(array $potentialNewFields, array $potentialDeletedFields)
 {
     $renamedFieldsMapping = array();
     if (count($potentialNewFields) && count($potentialDeletedFields)) {
         $deletedFields = $potentialDeletedFields;
         foreach ($potentialNewFields as $potentialNewField) {
             if (!count($potentialDeletedFields)) {
                 break;
             }
             // array_values is to reset the keys
             $potentialRenamedFields = array_values($potentialDeletedFields);
             $questionChoices = array_merge(array('none of them'), $potentialRenamedFields);
             // @201004142017
             $question = "Please make your choice for answering this question \n";
             $question .= "Is {$this->tableName}.{$potentialNewField} a renamed version of:";
             $answer = Nextgen_Core_UserInteraction::askQuestionWithChoices($question, $questionChoices);
             // -1 because of the line @201004142017
             if (array_key_exists($answer - 1, $potentialRenamedFields)) {
                 $renamedFieldsMapping[$potentialRenamedFields[$answer - 1]] = $potentialNewField;
                 Nextgen_Utils::removeElementFromArray($potentialRenamedFields[$answer - 1], $potentialDeletedFields);
             }
         }
     }
     return $renamedFieldsMapping;
 }
 private function getRenamedTablesMapping(array $potentialNewTables, array $potentialDeletedTables)
 {
     $renamedTablesMapping = array();
     if (count($potentialNewTables) && count($potentialDeletedTables)) {
         $deletedTables = $potentialDeletedTables;
         foreach ($potentialNewTables as $potentialNewTable) {
             if (!count($potentialDeletedTables)) {
                 break;
             }
             $potentialRenamedTablesWithScore = array();
             foreach ($potentialDeletedTables as $potentialDeletedTable) {
                 $score = $this->db2->getTable($potentialNewTable)->getSimilarityScore($this->db1->getTable($potentialDeletedTable));
                 $potentialRenamedTablesWithScore[$score] = $potentialDeletedTable;
             }
             ksort($potentialRenamedTablesWithScore);
             $potentialRenamedTablesSorted = array_values($potentialRenamedTablesWithScore);
             $questionChoices = array_merge(array('none of them'), $potentialRenamedTablesSorted);
             // @201004142017
             $question = "Please make your choice for answering this question \n";
             $question .= "Is {$potentialNewTable} a renamed version of:";
             $answer = Nextgen_Core_UserInteraction::askQuestionWithChoices($question, $questionChoices);
             // -1 because of the line @201004142017
             if (array_key_exists($answer - 1, $potentialRenamedTablesSorted)) {
                 $renamedTablesMapping[$potentialRenamedTablesSorted[$answer - 1]] = $potentialNewTable;
                 Nextgen_Utils::removeElementFromArray($potentialRenamedTablesSorted[$answer - 1], $potentialDeletedTables);
             }
         }
     }
     return $renamedTablesMapping;
 }