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

Voice   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
c 2
b 1
f 0
lcom 1
cbo 2
dl 0
loc 25
ccs 6
cts 7
cp 0.8571
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateSelf() 0 9 3
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