DsManagerModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 2
c 4
b 0
f 2
lcom 0
cbo 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
toArray() 0 1 ?
A fromArray() 0 9 2
1
<?php
2
3
4
namespace App\Lib\DsManager\Models\Common;
5
6
7
use App\Lib\DsManager\Models\Common\Interfaces\ActiveModel;
8
9
/**
10
 * Class DsManagerModel
11
 * @package App\Lib\DsManager\Models\Common
12
 */
13
abstract class DsManagerModel implements ActiveModel
14
{
15
    /**
16
     * @var
17
     */
18
    public $id;
19
20
    /**
21
     * @return mixed
22
     */
23
    abstract function toArray();
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
24
	/**
25
	 * @param array $array
26
	 * @return mixed
27
	 */
28
	public static function fromArray($array =[])
29
	{
30
		$class = get_called_class();
31
		$class = new $class();
32
		foreach ($array as $key => $value) {
33
			$class->$key = $value;
34
		}
35
		return $class;
36
	}
37
}