Image   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateSelf() 0 12 4
1
<?php
2
3
/*
4
 * This file is part of the light/easemob.
5
 *
6
 * (c) lichunqiang <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace light\Easemob\Message;
13
14
use light\Easemob\Exception\InvalidArgumentException;
15
16
class Image extends Message
17
{
18
    /**
19
     * Message type.
20
     *
21
     * @var string
22
     */
23
    protected $type = self::TYPE_IMG;
24
25
    protected $properties = ['url', 'filename', 'secret', 'size'];
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 2
    protected function validateSelf()
31
    {
32 2
        parent::validateSelf();
33 2
        foreach ($this->properties as $prop) {
34 2
            if ('size' == $prop) {
35 2
                continue;
36
            }
37 2
            if (empty($this->{$prop})) {
38
                throw new InvalidArgumentException("{$prop} can not be null");
39
            }
40 2
        }
41 2
    }
42
}
43