Completed
Push — master ( 44e430...fa5669 )
by Raffael
11:31
created

Installation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A start() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * balloon
7
 *
8
 * @copyright   Copryright (c) 2012-2018 gyselroth GmbH (https://gyselroth.com)
9
 * @license     GPL-3.0 https://opensource.org/licenses/GPL-3.0
10
 */
11
12
namespace Balloon\App\Notification\Migration\Delta;
13
14
use Balloon\Migration\Delta\DeltaInterface;
15
use MongoDB\Database;
16
17
class Installation implements DeltaInterface
18
{
19
    /**
20
     * Database.
21
     *
22
     * @var Database
23
     */
24
    protected $db;
25
26
    /**
27
     * Construct.
28
     *
29
     * @param Database $db
30
     */
31
    public function __construct(Database $db)
32
    {
33
        $this->db = $db;
34
    }
35
36
    /**
37
     * Start.
38
     *
39
     * @return bool
40
     */
41
    public function start(): bool
42
    {
43
        $this->db->selectCollection('subscription')->createIndex(['node' => 1]);
44
        $this->db->selectCollection('subscription')->createIndex(['user' => 1]);
45
        $this->db->selectCollection('notification')->createIndex(['receiver' => 1]);
46
        $this->db->selectCollection('notification')->createIndex(['sender' => 1]);
47
48
        return true;
49
    }
50
}
51