Completed
Push — master ( d34ae1...d2cd4a )
by kill
10:24
created

PinYin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A noun() 0 8 2
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
}