Completed
Push — develop ( 8387b5...1b51bd )
by Daniel
11:34
created

menu   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 43
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set_menu_id() 0 8 2
A set_menu_name() 0 5 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2015 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\model\entity;
11
12
use blitze\sitemaker\model\base_entity;
13
14
/**
15
 * @method integer get_menu_id()
16
 * @method string get_menu_name()
17
 * @method object set_items(\blitze\sitemaker\model\collections\items $items)
18
 * @method \blitze\sitemaker\model\collections\items get_items()
19
 */
20
final class menu extends base_entity
21
{
22
	/** @var integer */
23
	protected $menu_id;
24
25
	/** @var string */
26
	protected $menu_name = '';
27
28
	/** @var \blitze\sitemaker\model\collections\items */
29
	protected $items = array();
30
31
	/** @var array */
32
	protected $required_fields = array('menu_name');
33
34
	/** @var array */
35
	protected $db_fields = array(
36
		'menu_name',
37
	);
38
39
	/**
40
	 * Set menu ID
41
	 * @param int $menu_id
42
	 * @return $this
43
	 */
44 27
	public function set_menu_id($menu_id)
45
	{
46 27
		if (!$this->menu_id)
47 27
		{
48 27
			$this->menu_id = (int) $menu_id;
49 27
		}
50 27
		return $this;
51
	}
52
53
	/**
54
	 * @param string $name
55
	 * @return $this
56
	 */
57 26
	public function set_menu_name($name)
58
	{
59 26
		$this->menu_name = ucwords(trim($name));
60 26
		return $this;
61
	}
62
}
63