PinYin::noun()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 5
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by IntelliJ IDEA.
4
 * User: rozbo
5
 * Date: 2017/2/28
6
 * Time: 下午4:50
7
 */
8
9
namespace puck\helpers;
10
11
use Overtrue\Pinyin\Pinyin as VendorPinyin;
12
class PinYin extends VendorPinyin {
13
14
    public function noun($str) {
15
        $pinyinArr=$this->convert($str);
16
        foreach ($pinyinArr as &$pinyin) {
17
            //首字母转大写
18
            $pinyin[0]=strtoupper($pinyin[0]);
19
        }
20
        return implode('', $pinyinArr);
21
    }
22
}