DsManagerModel::toArray()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 1
nc 1
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
}