Issues (1686)

sources/ElkArte/Helper/SuggestMember.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Functions to search for a member by real name or member name, invoked
5
 * via xml form requests
6
 *
7
 * @package   ElkArte Forum
8
 * @copyright ElkArte Forum contributors
9
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
10
 *
11
 * This file contains code covered by:
12
 * copyright: 2011 Simple Machines (http://www.simplemachines.org)
13
 *
14
 * @version 2.0 dev
15
 *
16
 */
17
18
namespace ElkArte\Helper;
19
20
/**
21
 * Suggesting names (basically a wrapper for getMember)
22
 */
23
class SuggestMember
24
{
25
	/** @var string What we are going to search for */
26
	private $_search;
27
28
	/** @var array Any special parameters for the search */
29
	private $_params;
30
31
	/**
32
	 * @param string $search
33
	 * @param array $params
34
	 */
35
	public function __construct($search, $params)
36
	{
37
		$this->_search = trim(Util::strtolower(urldecode($search))) . '*';
38
		$this->_params = $params;
39
	}
40
41
	/**
42
	 * Search for a member - by real_name or member_name by default.
43
	 *
44
	 * @return array
45
	 */
46
	public function member()
47
	{
48
		// Escape the search string
49
		$this->_search = strtr($this->_search, ['%' => '\%', '_' => '\_', '*' => '%', '?' => '_', '&#038;' => '&amp;']);
50
51
		require_once(SUBSDIR . '/Members.subs.php');
52
53
		// Find the member.
54
		return getMember($this->_search, empty($this->_params['buddies']) ? array() : User::$info->buddies);
0 ignored issues
show
The type ElkArte\Helper\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
55
	}
56
}
57