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

umbrellio / php-table-sync / 4530357316

pending completion
4530357316

push

github

GitHub
 Added support for Laravel 10 (#19)

17 of 32 new or added lines in 12 files covered. (53.13%)

5 existing lines in 5 files now uncovered.

252 of 660 relevant lines covered (38.18%)

16.45 hits per line

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

0.0
/src/Rabbit/ChannelContainer.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Umbrellio\TableSync\Rabbit;
6

7
use PhpAmqpLib\Channel\AMQPChannel;
8

9
class ChannelContainer
10
{
11
    private AMQPChannel $channel;
12
    private array $channelOptions = [
13
        'prefetch_size' => null,
14
        'prefetch_count' => 1,
15
        'a_global' => true,
16
    ];
17

18
    public function __construct(
19
        private readonly ConnectionContainer $connectionContainer
20
    ) {
UNCOV
21
    }
×
22

23
    public function __destruct()
24
    {
25
        if (isset($this->channel)) {
×
26
            $this->channel->close();
×
27
        }
28
    }
29

30
    public function setChannelOption($option): void
31
    {
32
        if (!empty($option['prefetch_size'])) {
×
33
            $this->channelOptions['prefetch_size'] = $option['prefetch_size'];
×
34
        }
35
        if (!empty($option['prefetch_count'])) {
×
36
            $this->channelOptions['prefetch_count'] = $option['prefetch_count'];
×
37
        }
38
        if (!empty($option['a_global'])) {
×
39
            $this->channelOptions['a_global'] = $option['a_global'];
×
40
        }
41
    }
42

43
    public function getChannel(): AMQPChannel
44
    {
45
        if (!isset($this->channel)) {
×
46
            $this->channel = $this->connectionContainer->connection()
×
47
                ->channel();
×
48
            $this->channel->basic_qos(
×
49
                $this->channelOptions['prefetch_size'],
×
50
                $this->channelOptions['prefetch_count'],
×
51
                $this->channelOptions['a_global']
×
52
            );
×
53
        }
54
        return $this->channel;
×
55
    }
56
}
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

© 2025 Coveralls, Inc