Completed
Push — master ( a7f28d...ab5f24 )
by Vladimir
05:13
created

Activator::withPayload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation;
6
7
use Illuminate\Support\Collection;
8
use FondBot\Conversation\Activators\Exact;
9
use FondBot\Conversation\Activators\InArray;
10
use FondBot\Conversation\Activators\Pattern;
11
use FondBot\Conversation\Activators\Contains;
12
use FondBot\Conversation\Activators\WithPayload;
13
use FondBot\Conversation\Activators\WithAttachment;
14
15
class Activator
16
{
17
    /**
18
     * Create "Exact" activator.
19
     *
20
     * @param string $value
21
     *
22
     * @param bool $caseSensitive
23
     *
24
     * @return Exact
25
     */
26 1
    public static function exact(string $value, bool $caseSensitive = false): Exact
27
    {
28 1
        return new Exact($value, $caseSensitive);
29
    }
30
31
    /**
32
     * @param string|array $needles
33
     *
34
     * @return Contains
35
     */
36 1
    public static function contains($needles): Contains
37
    {
38 1
        return new Contains($needles);
39
    }
40
41
    /**
42
     * Create "Pattern" activator.
43
     *
44
     * @param string $value
45
     *
46
     * @return Pattern
47
     */
48 1
    public static function pattern(string $value): Pattern
49
    {
50 1
        return new Pattern($value);
51
    }
52
53
    /**
54
     * Create "InArray" activator.
55
     *
56
     * @param array|Collection $values
57
     * @param bool $strict
58
     *
59
     * @return InArray
60
     */
61 1
    public static function inArray($values, bool $strict = true): InArray
62
    {
63 1
        return new InArray($values, $strict);
64
    }
65
66
    /**
67
     * Create "WithAttachment" activator.
68
     *
69
     * @param string|null $type
70
     *
71
     * @return WithAttachment
72
     */
73 1
    public static function withAttachment(string $type = null): WithAttachment
74
    {
75 1
        return new WithAttachment($type);
76
    }
77
78
    /**
79
     * Create "WithPayload" activator.
80
     *
81
     * @param string $value
82
     *
83
     * @return WithPayload
84
     */
85 1
    public static function withPayload(string $value): WithPayload
86
    {
87 1
        return new WithPayload($value);
88
    }
89
}
90