Passed
Push — master ( afb8f6...f8ce69 )
by payever
03:32
created

PluginCommandEntity::getMeta()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 1
1
<?php
2
/**
3
 * PHP version 5.4 and 7
4
 *
5
 * @package   Payever\Plugins
6
 * @author    Hennadii.Shymanskyi <[email protected]>
7
 * @copyright 2017-2019 payever GmbH
8
 * @license   MIT <https://opensource.org/licenses/MIT>
9
 */
10
11
namespace Payever\ExternalIntegration\Plugins\Http\MessageEntity;
12
13
use Payever\ExternalIntegration\Core\Base\MessageEntity;
14
use Payever\ExternalIntegration\Plugins\Enum\PluginCommandNameEnum;
15
16
/**
17
 * @method string getId()
18
 * @method string getName()
19
 * @method string getValue()
20
 * @method string|null getChannelType()
21
 * @method string|null getMinCmsVersion()
22
 * @method string|null getMaxCmsVersion()
23
 * @method array getMetadata()
24
 */
25
class PluginCommandEntity extends MessageEntity
26
{
27
    /** @var string */
28
    protected $id;
29
30
    /**
31
     * @var string
32
     * @see PluginCommandNameEnum
33
     */
34
    protected $name;
35
36
    /** @var string */
37
    protected $value;
38
39
    protected $channelType;
40
41
    /** @var string */
42
    protected $minCmsVersion;
43
44
    /** @var string */
45
    protected $maxCmsVersion;
46
47
    /**
48
     * Additional data with specific for each command fields
49
     *
50
     * @var array
51
     */
52
    protected $metadata = array();
53
54
    /**
55
     * @param string $key
56
     *
57
     * @return string|null
58
     */
59
    public function getMeta($key)
60
    {
61
        return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
62
    }
63
64
    /**
65
     * @param string $key
66
     * @param string $value
67
     *
68
     * @return $this
69
     */
70
    public function setMeta($key, $value)
71
    {
72
        $this->metadata[$key] = $value;
73
74
        return $this;
75
    }
76
}
77