<?php
/**
 * Chairman analysis.php helper v1.5
 *
 * Usage in future analysis.php:
 * require_once __DIR__ . '/Chairman/adapter/chairman_analysis_helper.php';
 * $ranking = chairman_ranking($race_date, $venue, $race_num);
 */

if (!isset($Chairman)) {
    require_once dirname(__DIR__) . '/bootstrap/chairman_bootstrap.php';
}
require_once __DIR__ . '/ChairmanAnalysisAdapter.php';

if (!isset($ChairmanAdapter)) {
    $ChairmanAdapter = new ChairmanAnalysisAdapter($Chairman, isset($config) && is_array($config) ? $config : array());
}

function chairman_boot() {
    global $ChairmanAdapter;
    return $ChairmanAdapter;
}

function chairman_payload($raceDate, $venue='', $raceNum=0) {
    return chairman_boot()->payload($raceDate,$venue,$raceNum);
}

function chairman_summary($raceDate, $venue='', $raceNum=0) {
    return chairman_boot()->summary($raceDate,$venue,$raceNum);
}

function chairman_ranking($raceDate, $venue='', $raceNum=0) {
    return chairman_boot()->ranking($raceDate,$venue,$raceNum);
}

function chairman_top($raceDate, $venue='', $raceNum=0) {
    return chairman_boot()->top($raceDate,$venue,$raceNum);
}

function chairman_debug() {
    return chairman_boot()->debug();
}
