DateRange   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 13
c 1
b 0
f 0
dl 0
loc 31
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilterAction() 0 3 1
A add() 0 8 3
A setInputFormat() 0 4 1
A setSearchFormat() 0 4 1
1
<?php
2
3
namespace kalanis\kw_table\form_nette\Fields;
4
5
6
use kalanis\kw_connect\core\Interfaces\IFilterFactory;
7
8
9
\kalanis\kw_table\form_nette\Controls\DateRange::register();
10
11
12
/**
13
 * Class DateRange
14
 * @package kalanis\kw_table_form_nette\Fields
15
 */
16
class DateRange extends AField
17
{
18
    protected string $inputFormat = '';
19
    protected string $searchFormat = '';
20
21
    public function getFilterAction(): string
22
    {
23
        return IFilterFactory::ACTION_RANGE;
24
    }
25
26
    public function add(): void
27
    {
28
        $this->form->addTbDateRange($this->alias, null, null, $this->attributes);
0 ignored issues
show
Unused Code introduced by
The call to kalanis\kw_table\form_ne...eForm::addTbDateRange() has too many arguments starting with null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        $this->form->/** @scrutinizer ignore-call */ 
29
                     addTbDateRange($this->alias, null, null, $this->attributes);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
29
        if ($this->inputFormat) {
30
            $this->form[$this->alias]->setInputFormat($this->inputFormat);
31
        }
32
        if ($this->searchFormat) {
33
            $this->form[$this->alias]->setSearchFormat($this->searchFormat);
34
        }
35
    }
36
37
    public function setInputFormat($format)
38
    {
39
        $this->inputFormat = $format;
40
        return $this;
41
    }
42
43
    public function setSearchFormat($format)
44
    {
45
        $this->searchFormat = $format;
46
        return $this;
47
    }
48
}
49