Completed
Push — master ( 374ee1...b2fae8 )
by Chris
03:51
created

ResponseFormatter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
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
use Phergie\Irc\Bot\React\AbstractPlugin;
14
use Phergie\Irc\Bot\React\EventQueueInterface as Queue;
15
use Phergie\Irc\Plugin\React\Command\CommandEventInterface as Event;
16
17
use Doctrine\DBAL\DriverManager;
18
use Psr\Log\LoggerAwareInterface;
19
20
/**
21
 * Response Formatter.
22
 *
23
 * @category Chrismou
24
 * @package Chrismou\Phergie\Plugin\Php
25
 */
26
class ResponseFormatter
27
{
28
    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...
29
    {
30
        return $this->buildParamString($function);
31
    }
32
33
    protected function buildParamString($param)
34
    {
35
        return sprintf(
36
            '%s%s %s%s%s',
37
            (isset($param['choice'])) ? '[ ' : '',
38
            $param['type'],
39
            $param['parameter'],
40
            isset($param['initializer']) ? sprintf(' = %s', $param['initializer']) : '',
41
            (isset($param['choice'])) ? ' ]' : ''
42
        );
43
    }
44
}
45