Completed
Push — develop ( 840c69...29c45a )
by René
03:26
created

TitleViewHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 10 1
1
<?php
2
3
/**
4
 * Class TitleViewHelper
5
 */
6
7
namespace HDNET\OnpageIntegration\ViewHelpers;
8
9
/**
10
 * Class TitleViewHelper
11
 */
12
class TitleViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
13
{
14
15
    /**
16
     * Removed the underscore and
17
     * uppercase the first character
18
     * of a snake case string
19
     *
20
     * @param string $title
21
     *
22
     * @return string
23
     */
24
    public function render($title)
25
    {
26
        $titleArray = explode('_', $title);
27
28
        $UpperTitle = array_map(function ($value) {
29
            return ucfirst($value);
30
        }, $titleArray);
31
32
        return implode(' ', $UpperTitle);
33
    }
34
}
35