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

ParametersHelper::invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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