Me   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 95.83%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 65
ccs 23
cts 24
cp 0.9583
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A favorites() 0 4 1
A notifications() 0 4 1
A profile() 0 15 2
A comments() 0 12 2
1
<?php
2
3
namespace Rs\VersionEye\Output;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
/**
8
 * Me.
9
 *
10
 * @author Robert Schönthal <[email protected]>
11
 */
12
class Me extends BaseOutput
13
{
14
    /**
15
     * output for the profile api.
16
     *
17
     * @param OutputInterface $output
18
     * @param array           $response
19
     */
20 1
    public function profile(OutputInterface $output, array $response)
21
    {
22 1
        $this->printList($output,
23 1
            ['Fullname', 'Username', 'Email', 'Admin', 'Notifications'],
24 1
            ['fullname', 'username', 'email', 'admin', 'notifications'],
25
            $response,
26 1
            function ($key, $value) {
27 1
                if ('Notifications' !== $key) {
28 1
                    return $value;
29
                }
30
31 1
                return sprintf('%d / %d', $value['new'], $value['total']);
32 1
            }
33
        );
34 1
    }
35
36
    /**
37
     * output for the favorites api.
38
     *
39
     * @param OutputInterface $output
40
     * @param array           $response
41
     */
42 2
    public function favorites(OutputInterface $output, array $response)
43
    {
44 2
        $this->printProducts($output, $response['favorites']);
45 2
    }
46
47
    /**
48
     * output for the notifications api.
49
     *
50
     * @param OutputInterface $output
51
     * @param array           $response
52
     */
53 2
    public function notifications(OutputInterface $output, array $response)
54
    {
55 2
        $this->printProducts($output, $response['notifications']);
56 2
    }
57
58
    /**
59
     * output for the comments api.
60
     *
61
     * @param OutputInterface $output
62
     * @param array           $response
63
     */
64 2
    public function comments(OutputInterface $output, array $response)
65
    {
66 2
        $table = $this->createTable($output);
67
68 2
        $table->setHeaders(['Name', 'Language', 'Version', 'Type', 'Date', 'Comment']);
69
70 2
        foreach ($response['comments'] as $comment) {
71 2
            $table->addRow([$comment['product']['name'], $comment['product']['language'], $comment['product']['version'], $comment['product']['prod_type'], $comment['created_at'], $comment['comment']]);
72
        }
73
74 2
        $table->render($output);
0 ignored issues
show
Unused Code introduced by
The call to Table::render() has too many arguments starting with $output.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
75 2
    }
76
}
77