PluginCommandEntity   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 11
c 1
b 0
f 0
dl 0
loc 51
rs 10

2 Methods

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