Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RegexCustomDataName | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
| 5 | */ |
| 6 | declare(strict_types=1); |
| 7 | |
| 8 | namespace pvc\html\val_tester\regex; |
| 9 | |
| 10 | use pvc\regex\Regex; |
| 11 | |
| 12 | /** |
| 13 | * Class RegexCustomDataName |
| 14 | */ |
| 15 | class RegexCustomDataName extends Regex |
| 16 | { |
| 17 | public function __construct() |
| 18 | { |
| 19 | /** |
| 20 | * according to various online sources, the data attribute id must be at least one character long and must |
| 21 | * be prefixed with 'data-'. It should not contain any uppercase letters. This regex restricts it to lower |
| 22 | * case letters and numbers |
| 23 | */ |
| 24 | $pattern = '/^[a-z0-9]*$/'; |
| 25 | $label = 'custom attribute id'; |
| 26 | $this->setPattern($pattern); |
| 27 | $this->setLabel($label); |
| 28 | } |
| 29 | } |