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

contributte / datagrid / 15346172910

30 May 2025 11:52AM UTC coverage: 35.492% (+1.4%) from 34.086%
15346172910

push

github

f3l1x
Fixed "Attempt to read property on array" error in ArrayDataSource

3 of 4 new or added lines in 1 file covered. (75.0%)

34 existing lines in 4 files now uncovered.

1200 of 3381 relevant lines covered (35.49%)

0.35 hits per line

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

80.0
/src/Filter/FilterText.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Datagrid\Filter;
4

5
use Contributte\Datagrid\Datagrid;
6
use Nette\Forms\Container;
7

8
class FilterText extends Filter
9
{
10

11
        protected ?string $template = 'datagrid_filter_text.latte';
12

13
        protected ?string $type = 'text';
14

15
        protected bool $exact = false;
16

17
        protected bool $splitWordsSearch = true;
18

19
        protected bool $conjunctionSearch = false;
20

21
        /**
22
         * @param array|string[] $columns
23
         */
24
        public function __construct(
1✔
25
                Datagrid $grid,
26
                string $key,
27
                string $name,
28
                protected array $columns
29
        )
30
        {
31
                parent::__construct($grid, $key, $name);
1✔
32
        }
1✔
33

34
        /**
35
         * Adds text field to filter form
36
         */
37
        public function addToFormContainer(Container $container): void
38
        {
39
                $control = $container->addText($this->key, $this->name);
×
40

41
                $this->addAttributes($control);
×
42

UNCOV
43
                if ($this->getPlaceholder() !== null) {
×
UNCOV
44
                        $control->setHtmlAttribute('placeholder', $this->getPlaceholder());
×
45
                }
46
        }
47

48
        /**
49
         * Return array of conditions to put in result [column1 => value, column2 => value]
50
         *         If more than one column exists in fitler text,
51
         *         than there is OR clause put betweeen their conditions
52
         * Or callback in case of custom condition callback
53
         */
54
        public function getCondition(): array
55
        {
56
                return array_fill_keys($this->columns, $this->getValue());
1✔
57
        }
58

59
        public function isExactSearch(): bool
60
        {
61
                return $this->exact;
1✔
62
        }
63

64
        /**
65
         * @return static
66
         */
67
        public function setExactSearch(bool $exact = true): self
1✔
68
        {
69
                $this->exact = $exact;
1✔
70

71
                return $this;
1✔
72
        }
73

74
        /**
75
         * @return static
76
         */
77
        public function setSplitWordsSearch(bool $splitWordsSearch): self
1✔
78
        {
79
                $this->splitWordsSearch = $splitWordsSearch;
1✔
80

81
                return $this;
1✔
82
        }
83

84
        public function hasSplitWordsSearch(): bool
85
        {
86
                return $this->splitWordsSearch;
1✔
87
        }
88

89
        public function setConjunctionSearch(bool $conjunctionSearch = true): void
1✔
90
        {
91
                $this->conjunctionSearch = $conjunctionSearch;
1✔
92
        }
1✔
93

94
        public function hasConjunctionSearch(): bool
95
        {
96
                return $this->conjunctionSearch;
1✔
97
        }
98

99
}
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