Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
n/a
0 / 0
n/a
0 / 0
CRAP
0.00% covered (danger)
0.00%
0 / 15
<?php
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
use QuickSurveys\SurveyFactory;
return [
    'QuickSurveys.Config' =>
        /**
         * Subset of configuration under the QuickSurveys namespace
         */
        static function ( MediaWikiServices $services ): Config {
            return $services->getService( 'ConfigFactory' )
                ->makeConfig( 'quicksurveys' );
        },
    'QuickSurveys.EnabledSurveys' =>
        /**
         * @param MediaWikiServices $services
         * @return \QuickSurveys\Survey[] List of active surveys to be selected from on the client
         */
        static function ( MediaWikiServices $services ): array {
            $config = $services->getService( 'QuickSurveys.Config' );
            $configuredSurveys = $config->has( 'QuickSurveysConfig' )
                ? $config->get( 'QuickSurveysConfig' )
                : [];
            $logger = LoggerFactory::getInstance( 'QuickSurveys' );
            $factory = new SurveyFactory( $logger );
            return $factory->parseSurveyConfig( $configuredSurveys );
        }
];