• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NIT-Administrative-Systems / SysDev-laravel-soa / 7805057844

06 Feb 2024 07:28PM UTC coverage: 45.675% (-0.2%) from 45.913%
7805057844

push

github

web-flow
Housekeeping (#162)

11 of 35 new or added lines in 14 files covered. (31.43%)

9 existing lines in 7 files now uncovered.

264 of 578 relevant lines covered (45.67%)

14.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Console/Commands/EventHub/WebhookToggle.php
1
<?php
2

3
namespace Northwestern\SysDev\SOA\Console\Commands\EventHub;
4

5
use Illuminate\Console\Command;
6
use Illuminate\Console\ConfirmableTrait;
7
use Northwestern\SysDev\SOA\EventHub;
8

9
class WebhookToggle extends Command
10
{
11
    use ConfirmableTrait;
12

13
    protected $signature = 'eventhub:webhook:toggle {status : pause or unpause} {queues?* : one or more queues to toggle. if unspecified, all queues will be updated.}';
14

15
    protected $description = 'Pause or unpause webhook deliveries.';
16

17
    protected $webhook_api;
18

19
    public function __construct(EventHub\Webhook $webhook_api)
20
    {
21
        parent::__construct();
×
22

23
        $this->webhook_api = $webhook_api;
×
24
    } // end __construct
25

26
    public function handle()
27
    {
28
        $queues = [];
×
29

30
        $status = strtolower($this->argument('status'));
×
31
        if (in_array($status, ['pause', 'unpause']) === false) {
×
32
            $this->error('Invalid status. Please specify pause or unpause.');
×
33

UNCOV
34
            return 1;
×
35
        }
36

37
        $specific_queues = $this->argument('queues');
×
NEW
38
        if (count($specific_queues) > 0) {
×
39
            $queues = $specific_queues;
×
40
        } else {
41
            $hooks = $this->webhook_api->listAll();
×
42
            $queues = collect($hooks['webhooks'])->map(function ($hook) {
×
43
                return $hook['topicName'];
×
44
            })->all();
×
45
        }
46

47
        foreach ($queues as $queue) {
×
48
            try {
49
                $this->webhook_api->$status($queue);
×
50
            } catch (EventHub\Exception\EventHubError $e) {
×
51
                $this->error(vsprintf('Unable to change status of "%s".', [$queue]));
×
52
                $this->line('');
×
53

UNCOV
54
                continue;
×
55
            }
56
        }
57

58
        // Display status after the changes are made.
59
        $this->call('eventhub:webhook:status');
×
60
    } // end handle
61

62
} // end WebhookToggle
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc