Completed
Push — master ( 874c42...3f0650 )
by Ryan
02:09
created

BuildResetForm::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 6
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
1
<?php namespace Anomaly\UsersModule\User\Command;
2
3
use Anomaly\Streams\Platform\Addon\Plugin\PluginForm;
4
use Anomaly\Streams\Platform\Support\Decorator;
5
use Anomaly\UsersModule\User\Reset\ResetFormBuilder;
6
use Illuminate\Contracts\Bus\SelfHandling;
7
8
/**
9
 * Class BuildResetForm
10
 *
11
 * @link          http://anomaly.is/streams-platform
12
 * @author        AnomalyLabs, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 * @package       Anomaly\UsersModule\User\Command
15
 */
16 View Code Duplication
class BuildResetForm implements SelfHandling
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...
17
{
18
19
    /**
20
     * The form parameters.
21
     *
22
     * @var array
23
     */
24
    protected $parameters;
25
26
    /**
27
     * Create a new BuildResetForm instance.
28
     *
29
     * @param array $parameters
30
     */
31
    public function __construct(array $parameters = [])
32
    {
33
        $this->parameters = $parameters;
34
    }
35
36
    /**
37
     * Handle the command.
38
     *
39
     * @param PluginForm $form
40
     * @param Decorator  $decorator
41
     * @return \Anomaly\Streams\Platform\Ui\Form\FormBuilder
42
     */
43
    public function handle(PluginForm $form, Decorator $decorator)
44
    {
45
        $parameters = array_merge_recursive($this->parameters, ['builder' => ResetFormBuilder::class]);
46
47
        return $decorator->decorate($form->make($parameters)->getForm());
48
    }
49
}
50