ParametersHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A invoke() 0 7 2
1
<?php
2
3
/**
4
 * This file is part of PhpUnitGen.
5
 *
6
 * (c) 2017-2018 Paul Thébaud <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PhpUnitGen\Renderer\Helper;
13
14
/**
15
 * Class ParametersHelper.
16
 *
17
 * @author     Paul Thébaud <[email protected]>.
18
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
19
 * @license    https://opensource.org/licenses/MIT The MIT license.
20
 * @link       https://github.com/paul-thebaud/phpunit-generator
21
 * @since      Class available since Release 2.0.0.
22
 */
23
class ParametersHelper
24
{
25
    /**
26
     * Convert an array of string parameters in string, with each parameters separated with a ','.
27
     *
28
     * @param string[] $parameters The parameters array.
29
     *
30
     * @return string The rendered parameters string.
31
     */
32
    public function invoke(array $parameters): string
33
    {
34
        $string = '';
35
        foreach ($parameters as $parameter) {
36
            $string .= $parameter . ', ';
37
        }
38
        return substr($string, 0, -2);
39
    }
40
}
41