Completed
Branch master (b7a0b6)
by Adrian
04:26 queued 02:31
created

AbstractStringRule   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 87.5%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 15
ccs 7
cts 8
cp 0.875
rs 10
c 2
b 0
f 1

1 Method

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