Completed
Push — master ( e5efba...5eb024 )
by Ivan
19:40
created

Item   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 10
c 0
b 0
f 0
ccs 0
cts 16
cp 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 7 1
A toCommandAttribute() 0 4 1
1
<?php namespace FreedomCore\TrinityCore\Console\Classes;
2
3
/**
4
 * Class Item
5
 * @package FreedomCore\TrinityCore\Console\Classes
6
 */
7
class Item
8
{
9
10
    /**
11
     * Item ID
12
     * @var int|null
13
     */
14
    protected $id = null;
15
16
    /**
17
     * Item Count
18
     * @var int|null
19
     */
20
    protected $count = null;
21
22
    /**
23
     * Item constructor.
24
     * @param int $itemID
25
     * @param int $itemCount
26
     */
27
    public function __construct(int $itemID, int $itemCount = 1)
28
    {
29
        $this->id = $itemID;
30
        $this->count = $itemCount;
31
    }
32
33
    /**
34
     * Convert Class Object To Array
35
     * @return array
36
     */
37
    public function toArray() : array
38
    {
39
        return [
40
            $this->id,
41
            $this->count
42
        ];
43
    }
44
45
    /**
46
     * Convert Class Object To TrinityCore Command Attribute
47
     * @return string
48
     */
49
    public function toCommandAttribute() : string
50
    {
51
        return implode(':', $this->toArray());
52
    }
53
}
54