Completed
Push — master ( ed7e26...883d13 )
by Maciej
12:17
created

StringHelper::camelCase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 9
rs 9.6666
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 noFirstCamelCase($str)
25
    {
26
        $str = self::camelCase($str);
27
        $str = lcfirst($str);
28
        return $str;
29
    }
30
31
    /**
32
     * @param $str
33
     * @return mixed|string
34
     */
35
    public static function camelCase($str)
36
    {
37
        $str = strtolower($str);
38
        $str = preg_replace('/[^a-z0-9]+/', ' ', $str);
39
        $str = trim($str);
40
        $str = ucwords($str);
41
        $str = str_replace(" ", "", $str);
42
        return $str;
43
    }
44
}
45