Failed Conditions
Push — newinternal-releasecandidate ( 2e1778...b14046 )
by Simon
15:26 queued 05:35
created

StringFunctions::upperCaseFirst()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 1
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
    public function upperCaseFirst($string)
21
    {
22
        if (ord($string) < 128) {
23
            return ucfirst($string);
24
        }
25
        else {
26
            return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1);
27
        }
28
    }
29
}
30