Completed
Push — master ( 449b8b...085560 )
by Robert
02:22
created

src/Output/Me.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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 1
            $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
            }
33 1
        );
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 2
        }
73
74 2
        $table->render($output);
0 ignored issues
show
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