Passed
Pull Request — newinternal (#556)
by Matthew
03:29
created

StringFunctions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
c 0
b 0
f 0
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A upperCaseFirst() 0 7 2
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 ******************************************************************************/
8
9
namespace Waca;
10
11
class StringFunctions
12
{
13
    /**
14
     * Make a string's first character uppercase
15
     *
16
     * @param string $string
17
     *
18
     * @return string
19
     */
20 1
    public function upperCaseFirst($string)
21
    {
22 1
        if (ord($string) < 128) {
23 1
            return ucfirst($string);
24
        }
25
        else {
26 1
            return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1);
27
        }
28
    }
29
}
30