Completed
Push — master ( 13d185...ef3226 )
by Maciej
14:21
created

StringHelper::camelCase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
/**
3
 * Created by Maciej Paprocki for Bureau-VA.
4
 * Date: 18/02/2016
5
 * Project Name: MaciekPaprocki\WordpressGuzzle
6
 * Time: 12:12
7
 */
8
9
namespace BureauVa\WordpressGuzzle\Helper;
10
11
/**
12
 * Class StringHelper
13
 * @package MaciekPaprocki\WordpressGuzzle
14
 */
15
16
class StringHelper
17
{
18
    /**
19
     * converts to camel case. Shamefully stolen from
20
     * @param $str
21
     * @param array $noStrip
0 ignored issues
show
Bug introduced by
There is no parameter named $noStrip. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
22
     * @return mixed|string
23
     */
24
    public static function camelCase($str)
25
    {
26
        // non-alpha and non-numeric characters become spaces
27
        $str = preg_replace('/[^\w\d]+/', ' ', $str);
28
        $str = trim($str);
29
        // uppercase the first character of each word
30
        $str = ucwords($str);
31
        $str = str_replace(" ", "", $str);
32
        $str = lcfirst($str);
33
34
        return $str;
35
    }
36
}
37