Completed
Push — master ( aeb11c...f98da5 )
by Adrian
02:32
created

AbstractStringRule   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 14
ccs 5
cts 6
cp 0.8333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getStringLength() 0 10 4
1
<?php
2
3
namespace Sirius\Validation\Rule;
4
5
abstract class AbstractStringRule extends AbstractRule
6
{
7
8 9
    protected function getStringLength($str)
9
    {
10 9
        if (function_exists('mb_strlen')) {
11 9
            return mb_strlen($str,
12 9
                (isset($this->options['encoding']) && $this->options['encoding']) ?
13 9
                    $this->options['encoding'] : mb_internal_encoding());
14
        }
15
16
        return strlen($str);
17
    }
18
}