Completed
Push — v2.0.x ( 2b2b8e...21aa40 )
by Florent
03:32
created

StringUtil   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 4
c 3
b 1
f 0
lcom 0
cbo 0
dl 0
loc 12
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A strlen() 0 4 2
A substr() 0 4 2
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose\Util;
13
14
/**
15
 * Class String.
16
 */
17
final class StringUtil
18
{
19
    public static function strlen($string)
20
    {
21
        return function_exists('mb_strlen') ? mb_strlen($string, '8bit') : strlen($string);
22
    }
23
24
    public static function substr($string, $start, $length = null)
25
    {
26
        return function_exists('mb_substr') ? mb_substr($string, $start, $length, '8bit') : substr($string, $start, $length);
27
    }
28
}
29