load_items   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 27
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 21 3
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 load_items extends base_action
13
{
14
	/**
15
	 * {@inheritdoc}
16
	 * @throws \blitze\sitemaker\exception\out_of_bounds
17
	 */
18 4
	public function execute()
19
	{
20 4
		$menu_id = $this->request->variable('menu_id', 0);
21
22
		if ($menu_id)
23 4
		{
24 3
			$menu_mapper = $this->mapper_factory->create('menus');
25
26
			/** @type \blitze\sitemaker\model\entity\menu $entity */
27 3
			if (($entity = $menu_mapper->load(array('menu_id', '=', $menu_id))) === null)
28 3
			{
29 1
				throw new \blitze\sitemaker\exception\out_of_bounds('menu_id');
30
			}
31
32 2
			$collection = $entity->get_items();
33
34 2
			return $this->get_items($collection);
35
		}
36
37
		return array(
38 1
			'items' => array()
39 1
		);
40
	}
41
}
42