Completed
Pull Request — master (#1)
by Raymond
02:17
created

MessageAction   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 38
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 4
1
<?php
2
3
namespace RayRutjes\GetEventStore;
4
5
final class MessageAction
6
{
7
    /**
8
     * Adds the message to the park queue.
9
     */
10
    const PARK = 'Park';
11
12
    /**
13
     * Retry the message.
14
     */
15
    const RETRY = 'Retry';
16
17
    /**
18
     * Forget about the message.
19
     */
20
    const SKIP = 'Skip';
21
22
    /**
23
     * @var string
24
     */
25
    private $action;
26
27
    /**
28
     * @param string $action
29
     */
30
    public function __construct(string $action)
31
    {
32
        switch ($action) {
33
            case self::PARK:
34
            case self::RETRY:
35
            case self::SKIP:
36
                break;
37
            default:
38
                throw new \InvalidArgumentException(sprintf('%s is an invalid message action.', $action));
39
        }
40
        $this->action = $action;
41
    }
42
}
43