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.

StringCaseTransform   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 85
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A toDash() 0 3 1
A toHyphen() 0 3 1
A camelCaseTransform() 0 3 1
A toSpace() 0 3 1
A toUpperCamelCase() 0 6 1
A toCamelCase() 0 12 1
1
<?php
2
3
namespace Soheilrt\AdobeConnectClient\Client\Helpers;
4
5
/**
6
 * Converts string into Camel Case and vice-versa.
7
 */
8
abstract class StringCaseTransform
9
{
10
    /**
11
     * Converts the Camel Case to Hyphen.
12
     *
13
     * @param string $term
14
     *
15
     * @return string
16
     */
17
    public static function toHyphen($term)
18
    {
19
        return static::camelCaseTransform(static::toCamelCase($term), '-');
20
    }
21
22
    /**
23
     * Converts the Camel Case to a string replace with the letter.
24
     *
25
     * @param string $term   The string to convert
26
     * @param string $letter The letter to replace with
27
     *
28
     * @return string
29
     */
30
    protected static function camelCaseTransform($term, $letter)
31
    {
32
        return mb_strtolower(preg_replace('/([A-Z])/', $letter . '$1', $term));
33
    }
34
35
    /**
36
     * Converts any string to camelCase.
37
     *
38
     * @param string $term
39
     *
40
     * @return string
41
     */
42
    public static function toCamelCase($term)
43
    {
44
        $term = preg_replace_callback(
45
            '/[\s_-](\w)/',
46
            function ($matches) {
47
                return mb_strtoupper($matches[1]);
48
            },
49
            $term
50
        );
51
        $term[0] = mb_strtolower($term[0]);
52
53
        return $term;
54
    }
55
56
    /**
57
     * Converts the Camel Case to Dash.
58
     *
59
     * @param string $term
60
     *
61
     * @return string
62
     */
63
    public static function toDash($term)
64
    {
65
        return static::camelCaseTransform(static::toCamelCase($term), '_');
66
    }
67
68
    /**
69
     * Converts the Camel Case to Space.
70
     *
71
     * @param string $term
72
     *
73
     * @return string
74
     */
75
    public static function toSpace($term)
76
    {
77
        return static::camelCaseTransform(static::toCamelCase($term), ' ');
78
    }
79
80
    /**
81
     * Converts any string to CamelCase.
82
     *
83
     * @param string $term
84
     *
85
     * @return string
86
     */
87
    public static function toUpperCamelCase($term)
88
    {
89
        $term = static::toCamelCase($term);
90
        $term[0] = mb_strtoupper($term[0]);
91
92
        return $term;
93
    }
94
}
95