ArgumentBag   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 61
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A done() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * Livia
4
 * Copyright 2017-2019 Charlotte Dunois, All Rights Reserved
5
 *
6
 * Website: https://charuru.moe
7
 * License: https://github.com/CharlotteDunois/Livia/blob/master/LICENSE
8
*/
9
10
namespace CharlotteDunois\Livia\Arguments;
11
12
/**
13
 * A fancy bag for our arguments. This class is used for a library-internal optimization.
14
 */
15
class ArgumentBag {
16
    /**
17
     * The argument this bag is for.
18
     * @var \CharlotteDunois\Livia\Arguments\Argument
19
     */
20
    public $argument;
21
    
22
    /**
23
     * The values.
24
     * @var mixed[]
25
     */
26
    public $values = array();
27
    
28
    /**
29
     * Maximum number of times to prompt for the argument.
30
     * @var int|float
31
     */
32
    public $promptLimit;
33
    
34
    /**
35
     * The prompt messages.
36
     * @var \CharlotteDunois\Yasmin\Models\Message[]
37
     */
38
    public $prompts = array();
39
    
40
    /**
41
     * The answer messages.
42
     * @var \CharlotteDunois\Yasmin\Models\Message[]
43
     */
44
    public $answers = array();
45
    
46
    /**
47
     * Whether the bag got cancelled.
48
     * @var string|null
49
     */
50
    public $cancelled;
51
    
52
    /**
53
     * Whether we are done.
54
     * @var bool
55
     */
56
    public $done = false;
57
    
58
    /**
59
     * Constructor.
60
     * @param \CharlotteDunois\Livia\Arguments\Argument  $argument
61
     * @param int|float                                  $promptLimit
62
     * @internal
63
     */
64
    function __construct(\CharlotteDunois\Livia\Arguments\Argument $argument, $promptLimit = \INF) {
65
        $this->argument = $argument;
66
        $this->promptLimit = $promptLimit;
67
    }
68
    
69
    /**
70
     * Closes the bag formally and returns itself.
71
     * @return $this
72
     */
73
    function done() {
74
        $this->done = true;
75
        return $this;
76
    }
77
}
78