<commit_before><?php
/*
  be.chiro.civi.kavo - support for the KAVO-API.
  Copyright (C) 2017  <NAME>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


/**
 * Kavo.Gettraject API specification (optional)
 * This is used for documentation and validation.
 *
 * @param array $spec description of fields supported by this API call
 * @return void
 * @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
 */
function _civicrm_api3_kavo_Gettraject_spec(&$spec) {
  $spec['kavo_id'] = [
    'type' => CRM_Utils_Type::T_STRING,
    'api.required' => 1,
  ];
}

/**
 * Kavo.Gettraject API
 *
 * @param array $params
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_kavo_Gettraject($params) {
  $kavo = new CRM_Kavo_KavoTool();
  $result = $kavo->getTraject($params['kavo_id']);
  return civicrm_api3_create_success($result, 'Kavo', 'gettraject');
}
<commit_msg>Refs #13 - Result values should be array instead of object.<commit_after><?php
/*
  be.chiro.civi.kavo - support for the KAVO-API.
  Copyright (C) 2017  <NAME>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


/**
 * Kavo.Gettraject API specification (optional)
 * This is used for documentation and validation.
 *
 * @param array $spec description of fields supported by this API call
 * @return void
 * @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
 */
function _civicrm_api3_kavo_Gettraject_spec(&$spec) {
  $spec['kavo_id'] = [
    'type' => CRM_Utils_Type::T_STRING,
    'api.required' => 1,
  ];
}

/**
 * Kavo.Gettraject API
 *
 * @param array $params
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_kavo_Gettraject($params) {
  $kavo = new CRM_Kavo_KavoTool();
  // hackity hackity
  $result = json_decode(json_encode($kavo->getTraject($params['kavo_id'])), TRUE);
  return civicrm_api3_create_success($result, 'Kavo', 'gettraject');
}

{'fraction_non_alphanumeric': 0.09500756429652042, 'fraction_numerical': 0.007261724659606656, 'mean_word_length': 4.2062992125984255, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2729332', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1021, 'n_words': 356}