Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| BIC | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 | |
0.00% |
0 / 1 |
| isValid | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package phpOMS\Validation\Finance |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace phpOMS\Validation\Finance; |
| 16 | |
| 17 | use phpOMS\Validation\ValidatorAbstract; |
| 18 | |
| 19 | /** |
| 20 | * Validate BIC |
| 21 | * |
| 22 | * @package phpOMS\Validation\Finance |
| 23 | * @license OMS License 2.0 |
| 24 | * @link https://jingga.app |
| 25 | * @since 1.0.0 |
| 26 | */ |
| 27 | final class BIC extends ValidatorAbstract |
| 28 | { |
| 29 | /** |
| 30 | * {@inheritdoc} |
| 31 | */ |
| 32 | public static function isValid(mixed $value, array $constraints = null) : bool |
| 33 | { |
| 34 | if (!\is_string($value)) { |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | return (bool) \preg_match('/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i', $value); |
| 39 | } |
| 40 | } |