| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | namespace Aurora\System; |
| 9: | |
| 10: | use Illuminate\Validation; |
| 11: | use Illuminate\Filesystem; |
| 12: | use Illuminate\Translation; |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | class Validator |
| 22: | { |
| 23: | public static function validate(array $aInputs, array $aRules, $aMessages = []) |
| 24: | { |
| 25: | $filesystem = new Filesystem\Filesystem(); |
| 26: | $fileLoader = new Translation\FileLoader($filesystem, ''); |
| 27: | $translator = new Translation\Translator($fileLoader, 'en_US'); |
| 28: | $factory = new Validation\Factory($translator); |
| 29: | |
| 30: | $validator = $factory->make($aInputs, $aRules, $aMessages); |
| 31: | |
| 32: | if ($validator->fails()) { |
| 33: | $errors = $validator->errors(); |
| 34: | throw new \Aurora\System\Exceptions\ValidationException(implode("; ", $errors->all()), \Aurora\System\Notifications::InvalidInputParameter); |
| 35: | } |
| 36: | } |
| 37: | } |
| 38: | |