<commit_before><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
 * @license         GNU Affero General Public License Version 3; see LICENSE.txt
 */
require_once APPLICATION_PATH . '/application/modules/Billapi/controllers/Billapi.php';

/**
 * Billapi controller for getting BillRun entities
 *
 * @package  Billapi
 * @since    5.5
 */
class ImportController extends BillapiController {
	
	protected $action;

	protected function runOperation() {
		$this->action = Models_Action::getInstance($this->params);
		if (!$this->action) {
			throw new Billrun_Exceptions_Api(999999, array(), 'Action cannot be found');
		}
		$this->output->status = 1;
		try {
			$results = $this->action->execute();
			foreach ($results as $result) {
				if($result !== true) {
					$this->output->status = 2;
					$this->output->warnings = [
						'Some rows were not imported'
					];
					break; 
				}
			}
			$this->output->details = $results;
		} catch (Exception $ex) {
			$this->output->status = 0;<commit_msg>BRCD-3333 fix(Import) - parse correct import plugin result<commit_after><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
 * @license         GNU Affero General Public License Version 3; see LICENSE.txt
 */
require_once APPLICATION_PATH . '/application/modules/Billapi/controllers/Billapi.php';

/**
 * Billapi controller for getting BillRun entities
 *
 * @package  Billapi
 * @since    5.5
 */
class ImportController extends BillapiController {
	
	protected $action;

	protected function runOperation() {
		$this->action = Models_Action::getInstance($this->params);
		if (!$this->action) {
			throw new Billrun_Exceptions_Api(999999, array(), 'Action cannot be found');
		}
		$this->output->status = 1;
		try {
			$results = $this->action->execute();
                        $imported_entities = isset($results['imported_entities']) ? $results['imported_entities'] : $result;
			foreach ($imported_entities as $result) {
				if($result !== true) {
					$this->output->status = 2;
					$this->output->warnings = [
						'Some rows were not imported'
					];
					break; 
				}
			}
			$this->output->details = $results;
		} catch (Exception $ex) {
			$this->output->status = 0;
{'fraction_non_alphanumeric': 0.1386986301369863, 'fraction_numerical': 0.018835616438356163, 'mean_word_length': 3.2568306010928962, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2488890', 'n_tokens_mistral': 815, 'n_tokens_neox': 686, 'n_words': 179}