GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f9513e...1e71bd )
by Simone
15:19 queued 10:20
created

StringParser   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 32
ccs 11
cts 14
cp 0.7856
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A numberOfTokens() 0 3 1
A camelize() 0 9 2
A exploded() 0 3 1
A tokenize() 0 3 1
A dotNotationFor() 0 4 1
1
<?php
2
3
namespace Mado\QueryBundle\Services;
4
5
class StringParser
6
{
7 31
    public function numberOfTokens(string $string)
8
    {
9 31
        return count($this->exploded($string));
10
    }
11
12 31
    private function exploded(string $string)
13
    {
14 31
        return explode('_', $string);
15
    }
16
17 31
    public function tokenize(string $string, int $position)
18
    {
19 31
        return $this->exploded($string)[$position];
20
    }
21
22 31
    public function camelize($string)
23
    {
24 31
        $camelized = $this->tokenize($string, 0);
25
26 31
        for ($i = 1; $i < $this->numberOfTokens($string); $i++) {
27 14
            $camelized .= ucfirst($this->tokenize($string, $i));
28
        }
29
30 31
        return $camelized;
31
    }
32
33
    public static function dotNotationFor(string $class)
34
    {
35
        $dottedFullyQualifiedClassName = str_replace( '\\', '.', $class);
36
        return strtolower($dottedFullyQualifiedClassName);
37
    }
38
}
39