ResponseFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * Phergie plugin for PHP function lookups (https://github.com/chrismou/phergie-irc-plugin-react-php)
4
 *
5
 * @link https://github.com/chrismou/phergie-irc-plugin-react-php for the canonical source repository
6
 * @copyright Copyright (c) 2016 Chris Chrisostomou (https://mou.me)
7
 * @license http://phergie.org/license New BSD License
8
 * @package Chrismou\Phergie\Plugin\Php
9
 */
10
11
namespace Chrismou\Phergie\Plugin\Php;
12
13
/**
14
 * Response Formatter.
15
 *
16
 * @category Chrismou
17
 * @package Chrismou\Phergie\Plugin\Php
18
 */
19
class ResponseFormatter
20
{
21
    public function format(array $function, $color = true)
0 ignored issues
show
Unused Code introduced by
The parameter $color is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        return $this->buildParamString($function);
24
    }
25
26
    protected function buildParamString($param)
27
    {
28
        return sprintf(
29
            '%s%s %s%s%s',
30
            (isset($param['choice'])) ? '[ ' : '',
31
            $param['type'],
32
            $param['parameter'],
33
            isset($param['initializer']) ? sprintf(' = %s', $param['initializer']) : '',
34
            (isset($param['choice'])) ? ' ]' : ''
35
        );
36
    }
37
}
38