Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
RegexAlphabetic
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * @package: pvc
4 * @author: Doug Wilbourne (dougwilbourne@gmail.com)
5 */
6
7declare(strict_types = 1);
8
9namespace pvc\regex\unicode;
10
11use pvc\regex\Regex;
12
13/**
14 * Class RegexAlphabetic
15 */
16class RegexAlphabetic extends Regex
17{
18
19    /**
20     * RegexAlphabetic constructor.
21     *
22     * we want letters represented as a single code point as well as letters modified by trailing
23     * combining marks.  So we verify that the first letter in the subpattern is a letter and that
24     * when the remaining code points in the subpattern are marks.
25     *
26     */
27    public function __construct()
28    {
29        $label = 'alphabetic text (only letters)';
30        /**
31         * the u modifier after the pattern tells the engine to treat both the pattern and the subject as UTF-8
32         */
33        $pattern = '/^(\p{L}\p{M}*)*$/u';
34        $this->setPattern($pattern);
35        $this->setLabel($label);
36    }
37}