Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 14
CargoJSONFormat
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 14
 allowedParameters
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 queryAndDisplay
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 12
<?php
/**
 * @author Yaron Koren
 * @ingroup Cargo
 */
class CargoJSONFormat extends CargoDeferredFormat {
    public static function allowedParameters() {
        return [ 'parse values' => [ 'type' => 'boolean' ] ];
    }
    /**
     * @param array $sqlQueries
     * @param array $displayParams Unused
     * @param array|null $querySpecificParams Unused
     * @return string HTML
     */
    public function queryAndDisplay( $sqlQueries, $displayParams, $querySpecificParams = null ) {
        $ce = SpecialPage::getTitleFor( 'CargoExport' );
        $queryParams = $this->sqlQueriesToQueryParams( $sqlQueries );
        $queryParams['format'] = 'json';
        if ( array_key_exists( 'parse values', $displayParams ) && $displayParams['parse values'] != '' ) {
            $queryParams['parse values'] = $displayParams['parse values'];
        }
        $linkAttrs = [
            'href' => $ce->getFullURL( $queryParams ),
        ];
        $text = Html::rawElement( 'a', $linkAttrs, wfMessage( 'cargo-viewjson' )->text() );
        return $text;
    }
}