Common   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A setProperties() 0 8 3
1
<?php
2
3
namespace veejay\jsonrpc\batch;
4
5
abstract class Common
6
{
7
    const VERSION = '2.0';
8
9
    /**
10
     * Jsonrpc version.
11
     * @var string
12
     */
13
    public $jsonrpc;
14
15
    /**
16
     * @var int|string|null
17
     */
18
    public $id;
19
20
    /**
21
     * Set properties using arbitrary dataset.
22
     * @param mixed $data
23
     * @return static
24
     */
25
    public function setProperties($data): self
26
    {
27
        foreach ((array)$data as $key => $value) {
28
            if (property_exists($this, $key)) {
29
                $this->$key = $value;
30
            }
31
        }
32
        return $this;
33
    }
34
}
35