ResponseFormatter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 5
c 2
b 1
f 0
lcom 0
cbo 0
dl 0
loc 19
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A format() 0 4 1
A buildParamString() 0 11 4
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