Completed
Push — master ( 98a062...441031 )
by Ryan
10:10
created

ChangeFieldAssignments::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php namespace Anomaly\Streams\Platform\Field\Command;
2
3
use Anomaly\Streams\Platform\Assignment\Command\ChangeAssignmentColumn;
4
use Anomaly\Streams\Platform\Field\Contract\FieldInterface;
5
use Illuminate\Foundation\Bus\DispatchesJobs;
6
7
/**
8
 * Class ChangeFieldAssignments
9
 *
10
 * @link   http://pyrocms.com/
11
 * @author PyroCMS, Inc. <[email protected]>
12
 * @author Ryan Thompson <[email protected]>
13
 */
14 View Code Duplication
class ChangeFieldAssignments
0 ignored issues
show
Duplication introduced by
This class 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...
15
{
16
17
    use DispatchesJobs;
18
19
    /**
20
     * The field instance.
21
     *
22
     * @var FieldInterface
23
     */
24
    protected $field;
25
26
    /**
27
     * Create a new ChangeFieldAssignments instance.
28
     *
29
     * @param FieldInterface $field
30
     */
31
    public function __construct(FieldInterface $field)
32
    {
33
        $this->field = $field;
34
    }
35
36
    /**
37
     * Handle the command.
38
     */
39
    public function handle()
40
    {
41
        foreach ($this->field->getAssignments() as $assignment) {
42
            $this->dispatch(new ChangeAssignmentColumn($assignment->setRelation('field', $this->field)));
43
        }
44
    }
45
}
46