Example #1
0
 public static function createNumerator($config)
 {
     $model = new NumeratorTemplate();
     $model->attributes = $config;
     if (!$model->save()) {
         $errorString = '';
         foreach ($model->getErrors() as $attribute) {
             $errorString .= implode('. ', $attribute);
         }
         throw new InvalidConfigException($errorString);
     }
     return new self(['template' => $model, 'masker' => new NumeratorMasker(['mask' => $model->mask])]);
 }