Passed
Push — master ( c28376...9b6cf0 )
by Georgi
07:09
created

Model::addCrits()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Epesi\Core\Data;
4
5
use atk4\data\Model as AtkModel;
6
7
class Model extends AtkModel
8
{
9
	/**
10
	 * Create atk4 model and assign default persistence
11
	 * 
12
	 * @param array $defaults
13
	 * 
14
	 * @return \Epesi\Core\Data\Model
15
	 */
16
	public static function create($defaults = [])
17
	{
18
		$atkDb = app()->make(Persistence\SQL::class);
19
		
20
		return new static($atkDb, $defaults);
21
	}
22
	
23
	public function addCrits($crits = [])
24
	{
25
		foreach ($crits as $condition) {
26
			$this->addCondition(...$condition);
27
		}
28
		
29
		return $this;
30
	}
31
}