Passed
Pull Request — master (#123)
by
unknown
04:16
created

ImplodeViewHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 6 1
A initializeArguments() 0 5 1
1
<?php
2
/**
3
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
4
 *
5
 * This file is part of the Kitodo and TYPO3 projects.
6
 *
7
 * @license GNU General Public License version 3 or later.
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace Kitodo\Dlf\ViewHelpers;
13
14
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
15
16
class ImplodeViewHelper extends AbstractViewHelper
17
{
18
    public function initializeArguments()
19
    {
20
        parent::initializeArguments();
21
        $this->registerArgument('value', 'array', 'The array to be imploded', true);
22
        $this->registerArgument('delimiter', 'string', 'The delimiter ', true);
23
    }
24
25
    /**
26
     * Checks if a value exists in an array.
27
     *
28
     * @return string
29
     */
30
    public function render()
31
    {
32
        $value = $this->arguments['value'];
33
        $delimiter = $this->arguments['delimiter'];
34
35
        return implode($delimiter, $value);
36
    }
37
}
38