Failed Conditions
Push — master ( eac8ff...e4a057 )
by Zbigniew
04:46
created

SharepReleaseTaskProcessor::supports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/sharep.
7
 *
8
 * (c) Zbigniew Ślązak
9
 */
10
11
namespace App\Slack\SlashCommand\Sharep;
12
13
use App\Slack\MessageBuilder\Layout;
14
use App\Slack\MessageBuilder\MessageFactory;
15
use App\Slack\SlashCommand\Data\CommandData;
16
use App\Slack\SlashCommand\TaskProcessorInterface;
17
18
class SharepReleaseTaskProcessor implements TaskProcessorInterface
19
{
20
    /** @var MessageFactory */
21
    private $messageFactory;
22
23 3
    public function __construct(MessageFactory $messageFactory)
24
    {
25 3
        $this->messageFactory = $messageFactory;
26 3
    }
27
28 2
    public function supports(CommandData $commandData): bool
29
    {
30 2
        return (bool) preg_match("/^release\s?/i", $commandData->text);
31
    }
32
33 1
    public function process(CommandData $commandData): Layout
34
    {
35 1
        $mf = $this->messageFactory;
36
37 1
        return $mf->layout(
38 1
            $mf->blockSection(
39 1
                $mf->elementPlainText('Please select dates to release'),
40 1
                $mf->elementMultiSelectStaticGroup(
41 1
                    'Select dates',
42 1
                    'sharep-release-multiselect-dates',
43 1
                    [],
44 1
                    null,
45 1
                    $mf->objectOptionGroup(
46 1
                        'Week 41',
47 1
                        $mf->objectOption('Mo 2019-11-11', '2019-11-11'),
48 1
                        $mf->objectOption('Tu 2019-11-12', '2019-11-12'),
49 1
                        $mf->objectOption('We 2019-11-13', '2019-11-13'),
50 1
                        $mf->objectOption('Th 2019-11-14', '2019-11-14'),
51 1
                        $mf->objectOption('Fr 2019-11-15', '2019-11-15'),
52
                    ),
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ')'
Loading history...
53 1
                    $mf->objectOptionGroup(
54 1
                        'Week 42',
55 1
                        $mf->objectOption('Mo 2019-11-18', '2019-11-18'),
56 1
                        $mf->objectOption('Tu 2019-11-19', '2019-11-19'),
57 1
                        $mf->objectOption('We 2019-11-20', '2019-11-20'),
58 1
                        $mf->objectOption('Th 2019-11-21', '2019-11-21'),
59 1
                        $mf->objectOption('Fr 2019-11-22', '2019-11-22'),
60
                    ),
61
                )
62
            )
63
        );
64
    }
65
}
66