Failed Conditions
Push — master ( 01c1f3...37c7e1 )
by Zbigniew
04:47
created

SharepReleaseTaskProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 27.27%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A supports() 0 4 1
A process() 0 11 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\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
    public function supports(CommandData $commandData): bool
29
    {
30
        return (bool) preg_match("/^release\s?/i", $commandData->text);
31
    }
32
33
    public function process(CommandData $commandData): Layout
34
    {
35
        $mf = $this->messageFactory;
36
37
        return $mf->layout(
38
            $mf->blockSection(
39
                $mf->elementPlainText('Please select date'),
40
                $mf->elementDatePicker('datepicker')
41
            )
42
        );
43
    }
44
}
45