Code Duplication    Length = 31-32 lines in 3 locations

src/Field/Command/RenameFieldAssignments.php 1 location

@@ 14-44 (lines=31) @@
11
 * @author PyroCMS, Inc. <[email protected]>
12
 * @author Ryan Thompson <[email protected]>
13
 */
14
class RenameFieldAssignments
15
{
16
    use DispatchesJobs;
17
18
    /**
19
     * The field instance.
20
     *
21
     * @var FieldInterface
22
     */
23
    protected $field;
24
25
    /**
26
     * Create a new RenameFieldAssignments instance.
27
     *
28
     * @param FieldInterface $field
29
     */
30
    public function __construct(FieldInterface $field)
31
    {
32
        $this->field = $field;
33
    }
34
35
    /**
36
     * Handle the command.
37
     */
38
    public function handle()
39
    {
40
        foreach ($this->field->getAssignments() as $assignment) {
41
            $this->dispatch(new RenameAssignmentColumn($assignment->setRelation('field', $this->field)));
42
        }
43
    }
44
}
45

src/Field/Command/UpdateFieldAssignments.php 1 location

@@ 14-44 (lines=31) @@
11
 * @author PyroCMS, Inc. <[email protected]>
12
 * @author Ryan Thompson <[email protected]>
13
 */
14
class UpdateFieldAssignments
15
{
16
    use DispatchesJobs;
17
18
    /**
19
     * The field instance.
20
     *
21
     * @var FieldInterface
22
     */
23
    protected $field;
24
25
    /**
26
     * Create a new UpdateFieldAssignments instance.
27
     *
28
     * @param FieldInterface $field
29
     */
30
    public function __construct(FieldInterface $field)
31
    {
32
        $this->field = $field;
33
    }
34
35
    /**
36
     * Handle the command.
37
     */
38
    public function handle()
39
    {
40
        foreach ($this->field->getAssignments() as $assignment) {
41
            $this->dispatch(new UpdateAssignmentColumn($assignment->setRelation('field', $this->field)));
42
        }
43
    }
44
}
45

src/Field/Command/ChangeFieldAssignments.php 1 location

@@ 14-45 (lines=32) @@
11
 * @author PyroCMS, Inc. <[email protected]>
12
 * @author Ryan Thompson <[email protected]>
13
 */
14
class ChangeFieldAssignments
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