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

Voice::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 Voice extends Message
8
{
9
    /**
10
     * Message type.
11
     *
12
     * @var string
13
     */
14
    protected $type = self::TYPE_VOICE;
15
16
    protected $properties = ['url', 'filename', 'length', 'secret'];
17
18
    /**
19
     * @inheritdoc
20
     */
21 2
    protected function validateSelf()
22
    {
23 2
        parent::validateSelf();
24 1
        foreach($this->properties as $prop) {
25 1
            if (empty($this->{$prop})) {
26
                throw new InvalidArgumentException("{$prop} can not be null");
27
            }
28 1
        }
29 1
    }
30
31
}
32