public static function validate_models_declaration(array $models) {

        foreach ($models as $model) {
            if (!isset($model['target'])) {
                throw new \coding_exception('Missing target declaration');
            }

            if (!static::is_valid($model['target'], '\core_analytics\local\target\base')) {
                throw new \coding_exception('Invalid target classname', $model['target']);
            }

            if (empty($model['indicators']) || !is_array($model['indicators'])) {
                throw new \coding_exception('Missing indicators declaration');
            }

            foreach ($model['indicators'] as $indicator) {
                if (!static::is_valid($indicator, '\core_analytics\local\indicator\base')) {
                    throw new \coding_exception('Invalid indicator classname', $indicator);
                }
            }

            if (isset($model['timesplitting'])) {
                if (substr($model['timesplitting'], 0, 1) !== '\\') {
                    throw new \coding_exception('Expecting fully qualified time splitting classname', $model['timesplitting']);
                }
                if (!static::is_valid($model['timesplitting'], '\core_analytics\local\time_splitting\base')) {
                    throw new \coding_exception('Invalid time splitting classname', $model['timesplitting']);
                }
            }

            if (!empty($model['enabled']) && !isset($model['timesplitting'])) {
                throw new \coding_exception('Cannot enable a model without time splitting method specified');
            }
        }
    }