MultiSelectUserElement   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 31
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
1
<?php
2
3
/** @noinspection DuplicatedCode, UnusedConstructorDependenciesInspection */
4
5
declare(strict_types=1);
6
7
/*
8
 * This file is part of the zibios/sharep.
9
 *
10
 * (c) Zbigniew Ślązak
11
 */
12
13
namespace App\Slack\MessageBuilder\Element;
14
15
use App\Slack\MessageBuilder\Enum\MessageTypeEnum;
16
use App\Slack\MessageBuilder\MessageJsonSerializeTrait;
17
use App\Slack\MessageBuilder\Object\ConfirmationDialogObject;
18
19
class MultiSelectUserElement implements SectionBlockElementInterface, InputBlockElementInterface
20
{
21
    use MessageJsonSerializeTrait;
22
23
    /** @var string */
24
    private $type;
25
    /** @var PlainTextElement */
26
    private $placeholder;
27
    /** @var string */
28
    private $actionId;
29
    /** @var array|string[] */
30
    private $initialUsers;
31
    /** @var ConfirmationDialogObject */
32
    private $confirmDialog;
33
34
    public function __construct(string $placeholder, string $actionId, array $initialUsers = [], ConfirmationDialogObject $confirmDialog = null)
35
    {
36
        if (\strlen($placeholder) > 150) {
37
            throw new \InvalidArgumentException('$text too long!');
38
        }
39
        if (\strlen($actionId) > 255) {
40
            throw new \InvalidArgumentException('$actionId too long!');
41
        }
42
43
        $this->type = MessageTypeEnum::ELEMENT_MULTI_SELECT_USER;
44
        $this->placeholder = new PlainTextElement($placeholder);
45
        $this->actionId = $actionId;
46
        $this->initialUsers = $initialUsers;
47
        $this->confirmDialog = $confirmDialog;
48
    }
49
}
50