Passed
Push — develop ( 4c7678...74dbd7 )
by Paul
02:25
created

ParametersHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

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