Completed
Push — v2.0.x ( 7a58b6 )
by Florent
24:58
created

StringUtil   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 14
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 1 1
A strlen() 0 4 2
A substr() 0 4 2
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2015 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
    private function __construct() {}
20
21
    public static function strlen($string)
22
    {
23
        return function_exists('mb_strlen') ? mb_strlen($string, '8bit') : strlen($string);
24
    }
25
26
    public static function substr($string, $start, $length = null)
27
    {
28
        return function_exists('mb_substr') ? mb_substr($string, $start, $length, '8bit') : substr($string, $start, $length);
29
    }
30
}
31