Completed
Push — develop ( fcce06...87d9a9 )
by Nate
02:07
created

UpdateOrganizationType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 36
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 4 1
A populate() 0 9 1
A find() 0 4 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/organization/license
6
 * @link       https://www.flipboxfactory.com/software/organization/
7
 */
8
9
namespace flipbox\organizations\actions\organizations;
10
11
use flipbox\craft\ember\actions\records\UpdateRecord;
12
use flipbox\organizations\records\OrganizationType;
13
use yii\db\ActiveRecord;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class UpdateOrganizationType extends UpdateRecord
20
{
21
    use PopulateOrganizationTypeTrait;
22
23
    /**
24
     * @inheritdoc
25
     */
26
    public function run($type)
27
    {
28
        return parent::run($type);
29
    }
30
31
    /**
32
     * @inheritdoc
33
     * @param OrganizationType $record
34
     * @return OrganizationType
35
     */
36
    protected function populate(ActiveRecord $record): ActiveRecord
37
    {
38
        parent::populate($record);
39
40
        $this->populateSiteLayout($record);
1 ignored issue
show
Compatibility introduced by
$record of type object<yii\db\ActiveRecord> is not a sub-type of object<flipbox\organizat...cords\OrganizationType>. It seems like you assume a child class of the class yii\db\ActiveRecord to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
41
        $this->populateSiteSettings($record);
1 ignored issue
show
Compatibility introduced by
$record of type object<yii\db\ActiveRecord> is not a sub-type of object<flipbox\organizat...cords\OrganizationType>. It seems like you assume a child class of the class yii\db\ActiveRecord to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
42
43
        return $record;
44
    }
45
46
    /**
47
     * @inheritdoc
48
     * @return OrganizationType|null
49
     */
50
    protected function find($identifier)
51
    {
52
        return OrganizationType::findOne($identifier);
53
    }
54
}
55