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

AbstractFormHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
set() 0 1 ?
get() 0 1 ?
A isCyrillic() 0 4 1
A isLatin() 0 4 1
A isText() 0 4 1
A isInteger() 0 4 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
}