Completed
Push — master ( 42b611...b70ab3 )
by light
02:44
created

Cmd::validateSelf()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.0261

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 9
ccs 6
cts 7
cp 0.8571
rs 9.6666
cc 3
eloc 5
nc 3
nop 0
crap 3.0261
1
<?php
2
3
namespace light\Easemob\Message;
4
5
use light\Easemob\Exception\InvalidArgumentException;
6
7
class Cmd extends Message
8
{
9
    /**
10
     * Message type.
11
     *
12
     * @var string
13
     */
14
    protected $type = self::TYPE_CMD;
15
16
    protected $properties = ['action'];
17
    /**
18
     * @inheritdoc
19
     */
20 2
    protected function validateSelf()
21
    {
22 2
        parent::validateSelf();
23 2
        foreach($this->properties as $prop) {
24 2
            if (empty($this->{$prop})) {
25
                throw new InvalidArgumentException("{$prop} can not be null");
26
            }
27 2
        }
28 2
    }
29
30
}
31