Completed
Push — master ( 519f76...318dd5 )
by Raffael
24:13 queued 15:29
created

AddWorkgroupSmbStorage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 34
ccs 0
cts 16
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 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * tubee
7
 *
8
 * @copyright   Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
9
 * @license     GPL-3.0 https://opensource.org/licenses/GPL-3.0
10
 */
11
12
namespace Tubee\Migration;
13
14
use MongoDB\Database;
15
16
class AddWorkgroupSmbStorage implements DeltaInterface
17
{
18
    /**
19
     * Database.
20
     *
21
     * @var Database
22
     */
23
    protected $db;
24
25
    /**
26
     * Construct.
27
     */
28
    public function __construct(Database $db)
29
    {
30
        $this->db = $db;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function start(): bool
37
    {
38
        $this->db->endpoints->updateMany([
39
            'data.storage.kind' => 'SmbStorage',
40
            'data.storage.workgroup' => ['$exists' => false],
41
        ], [
42
            '$set' => [
43
                'data.storage.workgroup' => null,
44
            ],
45
        ]);
46
47
        return true;
48
    }
49
}
50