Completed
Push — master ( d5c9e6...77b81f )
by Konstantin
02:19
created

AbstractFormHelper::isLatin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
nop 1
crap 1
1
<?php
2
3
namespace FormHelper;
4
5
abstract class AbstractFormHelper
6
{
7
    public abstract function set($data);
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
8
    public abstract function get();
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
9
10 2
    public function isCyrillic($word)
11
    {
12 2
        return (bool) preg_match("/[\p{Cyrillic}]/ui", $word);
13
    }
14
15 2
    public function isLatin($word)
16
    {
17 2
        return (bool) preg_match("/[\p{Latin}]/ui", $word);
18
    }
19
20 4
    public function isText($word)
21
    {
22 4
        return (bool) preg_match("/(\p{Latin}+|[\p{Cyrillic}]+)$/u", $word);
23
    }
24
25 2
    public function isInteger($digit)
26
    {
27 2
        return preg_match("/^\d+$/", $digit);
28
    }
29
}