| Total Complexity | 4 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 81.82% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | trait ValidatorsManagerInitTrait { |
||
| 12 | /** |
||
| 13 | * Parses models and save validators in cache |
||
| 14 | * to use in dev only |
||
| 15 | * @param array $config |
||
| 16 | */ |
||
| 17 | 1 | public static function initModelsValidators(&$config){ |
|
| 18 | 1 | $models=CacheManager::getModels($config,true); |
|
| 19 | 1 | foreach ($models as $model){ |
|
| 20 | 1 | $parser=new ValidationModelParser(); |
|
| 21 | 1 | $parser->parse($model); |
|
| 22 | 1 | $validators=$parser->getValidators(); |
|
| 23 | 1 | if(sizeof($validators)>0){ |
|
| 24 | 1 | self::store($model, $parser->__toString()); |
|
| 25 | } |
||
| 26 | } |
||
| 27 | 1 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Registers a validator type for using with @validator annotation |
||
| 31 | * @param string $type |
||
| 32 | * @param string $validatorClass |
||
| 33 | */ |
||
| 34 | public static function registerType($type,$validatorClass){ |
||
| 36 | } |
||
| 37 | } |
||
| 39 |