1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the XabbuhPandaBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Xabbuh\PandaBundle\Command; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Helper\Table; |
15
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
16
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Fetch notification status information via command-line. |
20
|
|
|
* |
21
|
|
|
* @author Christian Flothmann <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
final class ShowNotificationsCommand extends CloudCommand |
24
|
|
|
{ |
25
|
|
|
protected static $defaultName = 'panda:notifications:show'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* {@inheritDoc} |
29
|
|
|
*/ |
30
|
4 |
|
protected function configure() |
31
|
|
|
{ |
32
|
4 |
|
$this->setDescription('Show the current notification configuration'); |
33
|
|
|
|
34
|
4 |
|
parent::configure(); |
35
|
4 |
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* {@inheritDoc} |
39
|
|
|
*/ |
40
|
3 |
|
protected function doExecuteCommand(InputInterface $input, OutputInterface $output) |
41
|
|
|
{ |
42
|
3 |
|
$notifications = $this->getCloud($input)->getNotifications(); |
43
|
2 |
|
$table = new Table($output); |
44
|
2 |
|
$table->addRow(array('url', $notifications->getUrl())); |
45
|
|
|
|
46
|
2 |
|
if ($notifications->getNotificationEvent('video_created')->isActive()) { |
47
|
1 |
|
$table->addRow(array('video-created', '<info>enabled</info>')); |
48
|
|
|
} else { |
49
|
1 |
|
$table->addRow(array('video-created', 'disabled')); |
50
|
|
|
} |
51
|
|
|
|
52
|
2 |
|
if ($notifications->getNotificationEvent('video_encoded')->isActive()) { |
53
|
1 |
|
$table->addRow(array('video-encoded', '<info>enabled</info>')); |
54
|
|
|
} else { |
55
|
1 |
|
$table->addRow(array('video-encoded', 'disabled')); |
56
|
|
|
} |
57
|
|
|
|
58
|
2 |
|
if ($notifications->getNotificationEvent('encoding_progress')->isActive()) { |
59
|
1 |
|
$table->addRow(array('encoding-progress', '<info>enabled</info>')); |
60
|
|
|
} else { |
61
|
1 |
|
$table->addRow(array('encoding-progress', 'disabled')); |
62
|
|
|
} |
63
|
|
|
|
64
|
2 |
|
if ($notifications->getNotificationEvent('encoding_completed')->isActive()) { |
65
|
1 |
|
$table->addRow(array('encoding-completed', '<info>enabled</info>')); |
66
|
|
|
} else { |
67
|
1 |
|
$table->addRow(array('encoding-completed', 'disabled')); |
68
|
|
|
} |
69
|
|
|
|
70
|
2 |
|
$table->render($output); |
|
|
|
|
71
|
2 |
|
} |
72
|
|
|
} |
73
|
|
|
|
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.