Completed
Push — master ( dd351b...f9ab2e )
by Ryan
02:30
created

up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
use Anomaly\Streams\Platform\Database\Migration\Migration;
4
5
/**
6
 * Class AnomalyModulePreferencesUpdateUserRelatedConfig
7
 *
8
 * @link   http://pyrocms.com/
9
 * @author PyroCMS, Inc. <[email protected]>
10
 * @author Ryan Thompson <[email protected]>
11
 */
12
class AnomalyModulePreferencesUpdateUserRelatedConfig extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
15
    /**
16
     * Run the migrations.
17
     *
18
     * @return void
19
     */
20 View Code Duplication
    public function up()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        /* @var \Anomaly\Streams\Platform\Field\Contract\FieldInterface $field */
23
        $field = $this->fields()->findBySlugAndNamespace('user', 'preferences');
24
25
        $field->config = [
26
            'mode'    => 'lookup',
27
            'related' => 'Anomaly\UsersModule\User\UserModel',
28
        ];
29
30
        $field->save();
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38 View Code Duplication
    public function down()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        /* @var \Anomaly\Streams\Platform\Field\Contract\FieldInterface $field */
41
        $field = $this->fields()->findBySlugAndNamespace('user', 'preferences');
42
43
        $field->config = [
44
            'mode'     => 'lookup',
45
            'relation' => 'Anomaly\UsersModule\User\UserModel',
46
        ];
47
48
        $field->save();
49
    }
50
}
51