original_string: 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');
              }
          }
      }
code: 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');
              }
          }
      }
code_tokens: 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' ) ; } } }
docstring: Validate the declaration of prediction models according the syntax expected in the component's db folder.
  
  The expected structure looks like this:
  
  [
  [
  'target' => '\fully\qualified\name\of\the\target\class',
  'indicators' => [
  '\fully\qualified\name\of\the\first\indicator',
  '\fully\qualified\name\of\the\second\indicator',
  ],
  'timesplitting' => '\optional\name\of\the\time_splitting\class',
  'enabled' => true,
  ],
  ];
  
  @param array $models List of declared models.
  @throws \coding_exception Exception thrown in case of invalid syntax.
docstring_tokens: Validate the declaration of prediction models according the syntax expected in the component s db folder .