livesearch_controller::title_search()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * Ideas extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\ideas\controller;
12
13
/**
14
 * Ideas live search controller
15
 */
16
class livesearch_controller extends base
17
{
18
	/* @var \phpbb\ideas\factory\livesearch */
19
	protected $entity;
20
21
	/**
22
	 * Title search handler
23
	 *
24
	 * @return \Symfony\Component\HttpFoundation\JsonResponse
25
	 */
26
	public function title_search()
27
	{
28
		$title_chars = $this->request->variable('duplicateeditinput', '', true);
29
30
		$matches = $this->entity->title_search($title_chars, 10);
31
32
		return new \Symfony\Component\HttpFoundation\JsonResponse([
33
			'keyword' => $title_chars,
34
			'results' => $matches,
35
		]);
36
	}
37
}
38