Passed
Push — master ( e971d4...12dfa0 )
by Aimeos
16:55 queued 04:09
created

FosUser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 8

1 Method

Rating   Name   Duplication   Size   Complexity  
A FosUser::setRoles() 0 3 1

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2024
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Item;
12
13
14
/**
15
 * Customer DTO object for the FosUserBundle.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class FosUser extends Standard implements Iface
21
{
22
	/**
23
	 * Returns the associated user roles
24
	 *
25
	 * @return array List of Symfony roles
26
	 */
27
	public function getRoles() : array
28
	{
29
		return $this->get( 'roles', [] );
30
	}
31
32
33
	/**
34
	 * Sets the associated user roles
35
	 *
36
	 * @param array $roles List of Symfony roles
37
	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls
38
	 */
39
	public function setRoles( array $roles ) : \Aimeos\MShop\Customer\Item\Iface
40
	{
41
		return $this->set( 'roles', $roles );
42
	}
43
44
45
	/**
46
	 * Returns the password salt
47
	 *
48
	 * @return string Password salt
49
	 * @deprecated 2025.01 Not used for password hashing anymore
50
	 */
51
	public function getSalt() : string
52
	{
53
		return $this->get( 'salt', '' );
54
	}
55
56
57
	/**
58
	 * Sets the password salt
59
	 *
60
	 * @param string $value Password salt
61
	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls
62
	 * @deprecated 2025.01 Not used for password hashing anymore
63
	 */
64
	public function setSalt( string $value ) : \Aimeos\MShop\Customer\Item\Iface
65
	{
66
		return $this->set( 'salt', $value );
67
	}
68
}
69