Profile::generate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 0
cts 5
cp 0
crap 2
1
<?php
2
3
/**
4
 * Semantic representation of profile URLs
5
 *
6
 * @package   ElkArte Forum
7
 * @copyright ElkArte Forum contributors
8
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
9
 *
10
 * @version 2.0 dev
11
 *
12
 */
13
14
namespace ElkArte\UrlGenerator\Semantic;
15
16
/**
17
 * Class Profile
18
 *
19
 * @package ElkArte\UrlGenerator\Semantic
20
 */
21
class Profile extends Standard
22
{
23
	/**
24
	 * {@inheritDoc}
25
	 */
26
	protected $_types = ['profile'];
27
28
	/**
29
	 * {@inheritDoc}
30
	 */
31
	public function generate($params)
32
	{
33
		$url = 'p/' . urlencode(strtr($params['name'], ' ', '-')) . '-' . $params['u'];
34
		unset($params['name'], $params['u'], $params['action']);
35
36
		return $url . $this->_separator . $this->generateQuery($params);
37
	}
38
}
39