Passed
Push — patch_1-1-7 ( 90a951...ab62ad )
by Emanuele
04:23 queued 03:46
created

AbstractModel   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 3
1
<?php
2
3
/**
4
 * Most of the "models" require some common stuff (like a constructor).
5
 * Here it is.
6
 *
7
 * @name      ElkArte Forum
8
 * @copyright ElkArte Forum contributors
9
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
10
 *
11
 * @version 1.1
12
 *
13
 */
14
15
/**
16
 * Class AbstractModel
17
 *
18
 * Abstract base class for models.
19
 */
20
abstract class AbstractModel
21
{
22
	/**
23
	 * The database object
24
	 * @var database
25
	 */
26
	protected $_db = null;
27
28
	/**
29
	 * The modSettings
30
	 * @var object
31
	 */
32
	protected $_modSettings = array();
33
34
	/**
35
	 * Make "global" items available to the class
36
	 *
37
	 * @param object|null $db
38
	 */
39
	public function __construct($db = null)
40
	{
41
		global $modSettings;
42
43
		$this->_db = $db ?: database();
44
		$this->_modSettings = new \ElkArte\ValuesContainer($modSettings ?: array());
45
	}
46
}
47