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

contributte / datagrid / 8780667983

13 Mar 2024 12:24PM UTC coverage: 34.102%. Remained the same
8780667983

push

github

web-flow
[7.x] Next (#1060)

* PHP 8.0

* Translator: switch from ITranslator to Translator (#973)

* [7.x] Bootstrap 5 + PHP 8 + vanilla javascript (#1021)

* Bootstrap 5

* Bootstrap 5 (docs)

* Bootstrap 5

* form-control -> form-select

* Bump bootstrap-select for Bootstrap 5 support

* Removed `input-sm` from Bootstrap 3

See https://getbootstrap.com/docs/4.0/migration/#forms-1

* Bootstrap 5: When selectpicker, replace form-select classes with form-control and refresh it

* Hide `underline` also for `dropdown-item`. And merged into one CSS rule.

* Update the filterMultiSelect initialization

* Text-align: left -> start

Co-authored-by: Radim Vaculík <radim.vaculik@gmail.com>
Co-authored-by: Jaroslav Líbal <jaroslav.libal@neatous.cz>

* [7.x] phpstan-deprecation-rules (#1061)

* Fix sort

* Add method for setting custom Action href, v6.x (#853)

* [7.x] Nextras ORM 4 support, closes #984

* Fix ElasticsearchDataSource.php data source (#1041)

* Error: Typed property Ublaboo\DataGrid\InlineEdit\InlineEdit::$itemID must not be accessed before initialization

* composer: allow-plugins: php-http/discovery

* ItemDetailForm: $httpPost: Typed property must not be accessed...

* phpstan: revert  --memory-limit=4G

* NetteDatabaseSelectionHelper: Context -> Explorer, getSupplementalDriver -> getDriver

* Update README.md

* Templates: fix variables

* data-bs-toggle attribute for multiaction button (#1072)

* dependabot.yml (#1078)

* Allow nette/utils:4.0 (#1077)

* Add onColumnShow and onColumnHide event methods (#1076)

* Add onColumnShow and onColumnHide event methods

* Add native type array

* Removed duplicity

* Return value of BackedEnum when reading Doctrine entity property. (#1081)

* Return value of BackedEnum when reading array value (#1083)

* Added method to check if filter is on default values; Closes #1082 (#1084)

* ublaboo -> contributte (#1067) (#1075)

* Delete depe... (continued)

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

1455 existing lines in 67 files now uncovered.

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

64.71
/src/CsvDataModel.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Datagrid;
4

5
use Contributte\Datagrid\Column\Column;
6
use Nette\Localization\Translator;
7

8
class CsvDataModel
9
{
10

11
        /**
12
         * @param Column[] $columns
13
         */
14
        public function __construct(protected array $data, protected array $columns, protected Translator $translator)
1✔
15
        {
16
        }
1✔
17

18
        /**
19
         * Get data with header and "body"
20
         */
21
        public function getSimpleData(bool $includeHeader = true): array
1✔
22
        {
23
                $return = [];
1✔
24

25
                if ($includeHeader) {
1✔
26
                        $return[] = $this->getHeader();
1✔
27
                }
28

29
                foreach ($this->data as $item) {
1✔
UNCOV
30
                        $return[] = $this->getRow($item);
×
31
                }
32

33
                return $return;
1✔
34
        }
35

36
        public function getHeader(): array
37
        {
38
                $header = [];
1✔
39

40
                foreach ($this->columns as $column) {
1✔
UNCOV
41
                        $header[] = $this->translator->translate($column->getName());
×
42
                }
43

44
                return $header;
1✔
45
        }
46

47
        /**
48
         * Get item values saved into row
49
         */
50
        public function getRow(mixed $item): array
51
        {
UNCOV
52
                $row = [];
×
53

UNCOV
54
                foreach ($this->columns as $column) {
×
UNCOV
55
                        $row[] = strip_tags((string) $column->render($item));
×
56
                }
57

UNCOV
58
                return $row;
×
59
        }
60

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

© 2025 Coveralls, Inc