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

TitleViewHelper::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 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