Completed
Push — master ( e7b79c...402727 )
by Ryan
09:29
created

FlashFormErrors::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace Anomaly\Streams\Platform\Ui\Form\Command;
2
3
use Anomaly\Streams\Platform\Addon\FieldType\FieldType;
4
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
5
use Illuminate\Contracts\Bus\SelfHandling;
6
use Illuminate\Session\Store;
7
8
/**
9
 * Class FlashFormErrors
10
 *
11
 * @link          http://anomaly.is/streams-platform
12
 * @author        AnomalyLabs, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 * @package       Anomaly\Streams\Platform\Ui\Form\Command
15
 */
16 View Code Duplication
class FlashFormErrors 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 builder.
21
     *
22
     * @var FormBuilder
23
     */
24
    protected $builder;
25
26
    /**
27
     * Create a new FlashFormErrors instance.
28
     *
29
     * @param FormBuilder $builder
30
     */
31
    public function __construct(FormBuilder $builder)
32
    {
33
        $this->builder = $builder;
34
    }
35
36
    /**
37
     * Handle the event.
38
     *
39
     * @param Store $session
40
     */
41
    public function handle(Store $session)
42
    {
43
        $session->flash($this->builder->getOption('prefix') . 'errors', $this->builder->getFormErrors());
44
    }
45
}
46