Completed
Push — master ( 10405b...259f27 )
by wen
13:10
created

Select::setOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Sco\Admin\Display\Filters;
4
5
use Sco\Admin\Traits\HasSelectOptions;
6
7 View Code Duplication
class Select extends Filter
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...
8
{
9
    use HasSelectOptions;
10
11
    protected $type = 'select';
12
13
    protected $options;
14
15
    protected $defaultValue = '';
16
17
    public function __construct($name, $title, $options = null)
18
    {
19
        parent::__construct($name, $title);
20
21
        if (! is_null($options)) {
22
            $this->setOptions($options);
23
        }
24
    }
25
26
    public function toArray()
27
    {
28
        return parent::toArray() + [
29
                'options' => $this->getOptions(),
30
            ];
31
    }
32
}
33