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

webeweb / jquery-datatables-bundle / 9657863695

25 Jun 2024 06:54AM UTC coverage: 99.814% (+0.001%) from 99.813%
9657863695

push

github

webeweb
Add DataTables service

3750 of 3757 relevant lines covered (99.81%)

213.89 hits per line

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

100.0
/lib/bootstrap/Component/AbstractButton.php
1
<?php
2

3
/*
4
 * This file is part of the jquery-datatables-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types = 1);
13

14
namespace WBW\Bundle\BootstrapBundle\Component;
15

16
use WBW\Bundle\BootstrapBundle\Serializer\JsonSerializer;
17
use WBW\Library\Common\Traits\Booleans\BooleanActiveTrait;
18
use WBW\Library\Common\Traits\Strings\StringSizeTrait;
19
use WBW\Library\Common\Traits\Strings\StringTitleTrait;
20
use WBW\Library\Widget\Component\AbstractButton as BaseButton;
21

22
/**
23
 * Abstract button.
24
 *
25
 * @author webeweb <https://github.com/webeweb>
26
 * @package WBW\Bundle\BootstrapBundle\Component
27
 * @abstract
28
 */
29
abstract class AbstractButton extends BaseButton implements ButtonInterface {
30

31
    use BooleanActiveTrait;
32
    use StringSizeTrait;
33
    use StringTitleTrait;
34

35
    /**
36
     * Block.
37
     *
38
     * @var bool|null
39
     */
40
    private $block;
41

42
    /**
43
     * Data.
44
     *
45
     * @var array<string,mixed>
46
     */
47
    private $data;
48

49
    /**
50
     * Disabled.
51
     *
52
     * @var bool|null
53
     */
54
    private $disabled;
55

56
    /**
57
     * Outline.
58
     *
59
     * @var bool|null
60
     */
61
    private $outline;
62

63
    /**
64
     * Constructor.
65
     *
66
     * @param string|null $type The type.
67
     */
68
    protected function __construct(?string $type) {
69
        parent::__construct($type);
1,722✔
70
        $this->setData([]);
1,722✔
71
    }
656✔
72

73
    /**
74
     * Enumerate the sizes.
75
     *
76
     * @return string[] Returns the sizes.
77
     */
78
    public static function enumSizes(): array {
79

80
        return [
13✔
81
            self::BUTTON_SIZE_LG,
21✔
82
            self::BUTTON_SIZE_SM,
21✔
83
            self::BUTTON_SIZE_XS,
21✔
84
        ];
13✔
85
    }
86

87
    /**
88
     * Enumerate the types.
89
     *
90
     * @return string[] Returns the types.
91
     */
92
    public static function enumTypes(): array {
93

94
        return [
13✔
95
            self::BUTTON_TYPE_DANGER,
21✔
96
            self::BUTTON_TYPE_DARK,
21✔
97
            self::BUTTON_TYPE_DEFAULT,
21✔
98
            self::BUTTON_TYPE_INFO,
21✔
99
            self::BUTTON_TYPE_LIGHT,
21✔
100
            self::BUTTON_TYPE_LINK,
21✔
101
            self::BUTTON_TYPE_PRIMARY,
21✔
102
            self::BUTTON_TYPE_SECONDARY,
21✔
103
            self::BUTTON_TYPE_SUCCESS,
21✔
104
            self::BUTTON_TYPE_WARNING,
21✔
105
        ];
13✔
106
    }
107

108
    /**
109
     * {@inheritDoc}
110
     */
111
    public function getBlock(): ?bool {
112
        return $this->block;
1,071✔
113
    }
114

115
    /**
116
     * {@inheritDoc}
117
     */
118
    public function getData(): array {
119
        return $this->data;
1,050✔
120
    }
121

122
    /**
123
     * {@inheritDoc}
124
     */
125
    public function getDisabled(): ?bool {
126
        return $this->disabled;
1,071✔
127
    }
128

129
    /**
130
     * {@inheritDoc}
131
     */
132
    public function getOutline(): ?bool {
133
        return $this->outline;
1,071✔
134
    }
135

136
    /**
137
     * {@inheritDoc}
138
     */
139
    public function getPrefix(): ?string {
140
        return "btn-";
840✔
141
    }
142

143
    /**
144
     * {@inheritDoc}
145
     */
146
    public function jsonSerialize(): array {
147
        return JsonSerializer::serializeButton($this);
21✔
148
    }
149

150
    /**
151
     * {@inheritDoc}
152
     */
153
    public function setBlock(?bool $block): ButtonInterface {
154
        $this->block = $block;
1,197✔
155
        return $this;
1,197✔
156
    }
157

158
    /**
159
     * {@inheritDoc}
160
     */
161
    public function setData(array $data): ButtonInterface {
162
        $this->data = $data;
1,722✔
163
        return $this;
1,722✔
164
    }
165

166
    /**
167
     * {@inheritDoc}
168
     */
169
    public function setDisabled(?bool $disabled): ButtonInterface {
170
        $this->disabled = $disabled;
1,197✔
171
        return $this;
1,197✔
172
    }
173

174
    /**
175
     * {@inheritDoc}
176
     */
177
    public function setOutline(?bool $outline): ButtonInterface {
178
        $this->outline = $outline;
1,197✔
179
        return $this;
1,197✔
180
    }
181
}
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