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

Image   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 1
cbo 2
dl 0
loc 28
ccs 8
cts 9
cp 0.8889
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateSelf() 0 12 4
1
<?php
2
3
namespace light\Easemob\Message;
4
5
use light\Easemob\Exception\InvalidArgumentException;
6
7
class Image extends Message
8
{
9
    /**
10
     * Message type.
11
     *
12
     * @var string
13
     */
14
    protected $type = self::TYPE_IMG;
15
16
    protected $properties = ['url', 'filename', 'secret', 'size'];
17
18
    /**
19
     * @inheritdoc
20
     */
21 2
    protected function validateSelf()
22
    {
23 2
        parent::validateSelf();
24 2
        foreach($this->properties as $prop) {
25 2
            if ('size' == $prop) {
26 2
                continue;
27
            }
28 2
            if (empty($this->{$prop})) {
29
                throw new InvalidArgumentException("{$prop} can not be null");
30
            }
31 2
        }
32 2
    }
33
34
}
35