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

eliashaeussler / composer-update-check / 10714566433

05 Sep 2024 05:40AM UTC coverage: 20.475%. First build
10714566433

Pull #130

github

web-flow
Merge pull request #142 from eliashaeussler/task/lookup-progress

[TASK] Improve output of package lookup progress
Pull Request #130: [!!!][FEATURE] Modernize plugin

345 of 1786 new or added lines in 56 files covered. (19.32%)

371 of 1812 relevant lines covered (20.47%)

1.09 hits per line

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

0.0
/src/Entity/Report/Dto/TeamsContent.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/composer-update-check".
7
 *
8
 * Copyright (C) 2020-2024 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\ComposerUpdateCheck\Entity\Report\Dto;
25

26
use JsonSerializable;
27

28
use function array_filter;
29

30
/**
31
 * TeamsContent.
32
 *
33
 * @author Elias Häußler <elias@haeussler.dev>
34
 * @license GPL-3.0-or-later
35
 */
36
final class TeamsContent implements JsonSerializable
37
{
38
    /**
39
     * @param list<TeamsTableColumn>|null $columns
40
     * @param list<TeamsFact>|null        $facts
41
     * @param list<self>|null             $items
42
     * @param list<TeamsTableRow>|null    $rows
43
     */
NEW
44
    private function __construct(
×
45
        public readonly string $type,
46
        public readonly ?array $columns = null,
47
        public readonly ?array $facts = null,
48
        public readonly ?bool $firstRowAsHeader = null,
49
        public readonly ?string $gridStyle = null,
50
        public readonly ?string $id = null,
51
        public readonly ?bool $isVisible = null,
52
        public readonly ?array $items = null,
53
        public readonly ?array $rows = null,
54
        public readonly ?string $size = null,
55
        public readonly ?string $spacing = null,
56
        public readonly ?string $text = null,
57
        public readonly ?string $weight = null,
58
        public readonly ?bool $wrap = null,
NEW
59
    ) {}
×
60

61
    /**
62
     * @param list<self> $items
63
     */
NEW
64
    public static function container(
×
65
        array $items,
66
        bool $isVisible = true,
67
        string $id = null,
68
        string $spacing = null,
69
    ): self {
NEW
70
        return new self(
×
NEW
71
            type: 'Container',
×
NEW
72
            id: $id,
×
NEW
73
            isVisible: $isVisible,
×
NEW
74
            items: $items,
×
NEW
75
            spacing: $spacing,
×
NEW
76
        );
×
77
    }
78

79
    /**
80
     * @param list<TeamsFact> $facts
81
     */
NEW
82
    public static function factSet(array $facts, string $spacing = null): self
×
83
    {
NEW
84
        return new self(
×
NEW
85
            type: 'FactSet',
×
NEW
86
            facts: $facts,
×
NEW
87
            spacing: $spacing,
×
NEW
88
        );
×
89
    }
90

91
    /**
92
     * @param list<TeamsTableColumn> $columns
93
     * @param list<TeamsTableRow>    $rows
94
     */
NEW
95
    public static function table(
×
96
        array $columns,
97
        array $rows,
98
        bool $firstRowAsHeader = false,
99
        string $gridStyle = null,
100
    ): self {
NEW
101
        return new self(
×
NEW
102
            type: 'Table',
×
NEW
103
            columns: $columns,
×
NEW
104
            firstRowAsHeader: $firstRowAsHeader,
×
NEW
105
            gridStyle: $gridStyle,
×
NEW
106
            rows: $rows,
×
NEW
107
        );
×
108
    }
109

NEW
110
    public static function textBlock(
×
111
        string $text,
112
        bool $wrap = false,
113
        string $size = null,
114
        string $spacing = null,
115
        string $weight = null,
116
    ): self {
NEW
117
        return new self(
×
NEW
118
            type: 'TextBlock',
×
NEW
119
            size: $size,
×
NEW
120
            spacing: $spacing,
×
NEW
121
            text: $text,
×
NEW
122
            weight: $weight,
×
NEW
123
            wrap: $wrap,
×
NEW
124
        );
×
125
    }
126

127
    /**
128
     * @return array{
129
     *     type: string,
130
     *     columns?: list<TeamsTableColumn>,
131
     *     facts?: list<TeamsFact>,
132
     *     firstRowAsHeader?: bool,
133
     *     gridStyle?: string,
134
     *     id?: string,
135
     *     isVisible?: bool,
136
     *     items?: list<self>,
137
     *     rows?: list<TeamsTableRow>,
138
     *     size?: string,
139
     *     spacing?: string,
140
     *     text?: string,
141
     *     weight?: string,
142
     *     wrap?: bool,
143
     * }
144
     */
NEW
145
    public function jsonSerialize(): array
×
146
    {
NEW
147
        $body = [
×
NEW
148
            'type' => $this->type,
×
NEW
149
            'columns' => $this->columns,
×
NEW
150
            'facts' => $this->facts,
×
NEW
151
            'firstRowAsHeader' => $this->firstRowAsHeader,
×
NEW
152
            'gridStyle' => $this->gridStyle,
×
NEW
153
            'id' => $this->id,
×
NEW
154
            'isVisible' => $this->isVisible,
×
NEW
155
            'items' => $this->items,
×
NEW
156
            'rows' => $this->rows,
×
NEW
157
            'size' => $this->size,
×
NEW
158
            'spacing' => $this->spacing,
×
NEW
159
            'text' => $this->text,
×
NEW
160
            'weight' => $this->weight,
×
NEW
161
            'wrap' => $this->wrap,
×
NEW
162
        ];
×
163

NEW
164
        return array_filter($body, static fn (mixed $value) => null !== $value);
×
165
    }
166
}
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