ntk-andr / multi-exception
MultiException
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ntk-andr/multi-exception
Requires
- php: ^7.0
This package is not auto-updated.
Last update: 2026-01-18 07:37:31 UTC
README
Usage Example
use NtkAndr\MultiException; function checkPassword($passwd): bool { $errors = new MultiException(); if (empty($passwd)) { $errors->add(new Exception('Empty password')); } if (strlen($passwd) < 6) { $errors->add(new Exception('The password is too short')); } if (!preg_match('~\d~', $passwd)) { $errors->add(new Exception('The password doesn\'t contain numbers')); } if (!$errors->isEmpty()) { throw $errors; } return true; } try { checkPassword(''); } catch (MultiException $errors) { foreach ($errors as $error) { echo $error->getMessage() . "\n"; } }