delete_menu   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 16 2
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 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\services\menus\action;
11
12
class delete_menu extends base_action
13
{
14
	/**
15
	 * {@inheritdoc}
16
	 * @throws \blitze\sitemaker\exception\out_of_bounds
17
	 */
18 2
	public function execute()
19
	{
20 2
		$menu_id = $this->request->variable('menu_id', 0);
21
22 2
		$menu_mapper = $this->mapper_factory->create('menus');
23
24
		/** @type \blitze\sitemaker\model\entity\menu $entity */
25 2
		if (($entity = $menu_mapper->load(array('menu_id', '=', $menu_id))) === null)
26 2
		{
27 1
			throw new \blitze\sitemaker\exception\out_of_bounds('menu_id');
28
		}
29
30 1
		$menu_mapper->delete($entity);
31
32
		return array(
33 1
			'id'	=> $entity->get_menu_id(),
34 1
		);
35
	}
36
}
37