GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0e2603...abe0f1 )
by Robert
03:18
created

ObfuscateProductionEmailAddresses   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 41
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getCreateDate() 0 4 1
A getContexts() 0 4 1
A execute() 0 5 1
1
<?php
2
3
namespace Migrations;
4
5
use Gruberro\MongoDbMigrations;
6
7
class ObfuscateProductionEmailAddresses implements MongoDbMigrations\MigrationInterface, MongoDbMigrations\ContextualMigrationInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function getId()
13
    {
14
        return 'migration-3';
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getCreateDate()
21
    {
22
        return new \DateTime('2016-01-01 12:12:16');
23
    }
24
25
    /**
26
     * The obfuscation is relevant for both development and staging
27
     *
28
     * {@inheritdoc}
29
     */
30
    public function getContexts()
31
    {
32
        return ['development', 'staging'];
33
    }
34
35
    /**
36
     * Obfuscate all email addresses
37
     *
38
     * In case a production backup is restored, all email addresses are going to be obfuscated.
39
     *
40
     * {@inheritdoc}
41
     */
42
    public function execute(\MongoDB $db)
43
    {
44
        $userCollection = $db->selectCollection('user');
45
        $userCollection->update(['email_address' => ['$ne' => 'deleted']], ['email_address' => 'deleted'], ['multi' => true]);
46
    }
47
}
48