• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

contributte / datagrid / 8230157862

11 Mar 2024 09:02AM UTC coverage: 34.102%. First build
8230157862

Pull #1060

github

radimvaculik
Fix failing tests
Pull Request #1060: [7.x] Next

117 of 435 new or added lines in 54 files covered. (26.9%)

1124 of 3296 relevant lines covered (34.1%)

0.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/src/Column/FilterableColumn.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Datagrid\Column;
4

5
use Contributte\Datagrid\Datagrid;
6
use Contributte\Datagrid\Filter\FilterDate;
7
use Contributte\Datagrid\Filter\FilterDateRange;
8
use Contributte\Datagrid\Filter\FilterMultiSelect;
9
use Contributte\Datagrid\Filter\FilterRange;
10
use Contributte\Datagrid\Filter\FilterSelect;
11
use Contributte\Datagrid\Filter\FilterText;
12

13
abstract class FilterableColumn
14
{
15

16
        public function __construct(protected Datagrid $grid, protected string $key, protected string $column, protected string $name)
1✔
17
        {
18
        }
1✔
19

20
        public function setFilterText(string|array|null $columns = null): FilterText
21
        {
22
                if ($columns === null) {
×
23
                        $columns = [$this->column];
×
24
                } else {
25
                        $columns = is_string($columns)
×
26
                                ? [$columns]
×
27
                                : $columns;
×
28
                }
29

30
                return $this->grid->addFilterText($this->key, $this->name, $columns);
×
31
        }
32

33
        public function setFilterSelect(
34
                array $options,
35
                ?string $column = null
36
        ): FilterSelect
37
        {
NEW
38
                $column ??= $this->column;
×
39

40
                return $this->grid->addFilterSelect($this->key, $this->name, $options, $column);
×
41
        }
42

43
        public function setFilterMultiSelect(
44
                array $options,
45
                ?string $column = null
46
        ): FilterMultiSelect
47
        {
NEW
48
                $column ??= $this->column;
×
49

50
                return $this->grid->addFilterMultiSelect($this->key, $this->name, $options, $column);
×
51
        }
52

53
        public function setFilterDate(?string $column = null): FilterDate
54
        {
NEW
55
                $column ??= $this->column;
×
56

57
                return $this->grid->addFilterDate($this->key, $this->name, $column);
×
58
        }
59

60
        public function setFilterRange(
61
                ?string $column = null,
62
                string $nameSecond = '-'
63
        ): FilterRange
64
        {
NEW
65
                $column ??= $this->column;
×
66

67
                return $this->grid->addFilterRange($this->key, $this->name, $column, $nameSecond);
×
68
        }
69

70
        public function setFilterDateRange(
71
                ?string $column = null,
72
                string $nameSecond = '-'
73
        ): FilterDateRange
74
        {
NEW
75
                $column ??= $this->column;
×
76

77
                return $this->grid->addFilterDateRange($this->key, $this->name, $column, $nameSecond);
×
78
        }
79

80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc