InitializeMessageExchange20190311143000   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isReversible() 0 3 1
A getDescription() 0 5 2
A up() 0 4 1
A down() 0 4 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the ngutech/bitcoind-adapter project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace NGUtech\Bitcoind\Migration\RabbitMq;
10
11
use Daikon\RabbitMq3\Migration\RabbitMq3Migration;
12
use PhpAmqpLib\Exchange\AMQPExchangeType;
13
14
final class InitializeMessageExchange20190311143000 extends RabbitMq3Migration
15
{
16
    public function getDescription(string $direction = self::MIGRATE_UP): string
17
    {
18
        return $direction === self::MIGRATE_UP
19
            ? 'Create a RabbitMQ message exchange for the Bitcoind-Adapter context.'
20
            : 'Delete the RabbitMQ message message exchange for the Bitcoind-Adapter context.';
21
    }
22
23
    public function isReversible(): bool
24
    {
25
        return true;
26
    }
27
28
    public function up(): void
29
    {
30
        $this->createMigrationList('bitcoind.adapter.migration_list');
31
        $this->declareExchange('bitcoind.adapter.exchange', AMQPExchangeType::TOPIC, false, true, false);
32
    }
33
34
    public function down(): void
35
    {
36
        $this->deleteExchange('bitcoind.adapter.exchange');
37
        $this->deleteExchange('bitcoind.adapter.migration_list');
38
    }
39
}
40