Passed
Push — master ( 3c3bea...36cb3b )
by Aimeos
17:26
created

User::__serialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2014-2023
6
 */
7
8
9
namespace Aimeos\ShopBundle\Entity;
10
11
use Doctrine\ORM\Mapping as ORM;
12
use Aimeos\ShopBundle\Repository\UserRepository;
0 ignored issues
show
Bug introduced by
The type Aimeos\ShopBundle\Repository\UserRepository 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...
13
use Symfony\Component\Security\Core\User\UserInterface;
14
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
15
16
17
#[ORM\Entity(repositoryClass: UserRepository::class)]
18
class User implements UserInterface
19
{
20
	#[ORM\Id]
21
	#[ORM\Column(name: "id", type: "integer")]
22
	#[ORM\GeneratedValue(strategy: "AUTO")]
23
	protected $id;
24
25
	#[ORM\Column(name: "siteid", type: "string", length: 255)]
26
	protected $siteid;
27
28
	#[ORM\Column(name: "label", type: "string", length: 255)]
29
	protected $label;
30
31
	#[ORM\Column(name: "code", type: "string", length: 255)]
32
	protected $username;
33
34
	#[ORM\Column(name: "password", type: "string", length: 255)]
35
	protected $password;
36
37
	#[ORM\Column(name: "status", type: "smallint")]
38
	protected $isActive;
39
40
	#[ORM\Column(name: "salutation", type: "string", length: 8)]
41
	protected $salutation = '';
42
43
	#[ORM\Column(name: "company", type: "string", length: 100)]
44
	protected $company = '';
45
46
	#[ORM\Column(name: "vatid", type: "string", length: 32)]
47
	protected $vatid = '';
48
49
	#[ORM\Column(name: "title", type: "string", length: 64)]
50
	protected $title = '';
51
52
	#[ORM\Column(name: "firstname", type: "string", length: 64)]
53
	protected $firstname = '';
54
55
	#[ORM\Column(name: "lastname", type: "string", length: 64)]
56
	protected $lastname = '';
57
58
	#[ORM\Column(name: "address1", type: "string", length: 200)]
59
	protected $address1 = '';
60
61
	#[ORM\Column(name: "address2", type: "string", length: 200)]
62
	protected $address2 = '';
63
64
	#[ORM\Column(name: "address3", type: "string", length: 200)]
65
	protected $address3 = '';
66
67
	#[ORM\Column(name: "postal", type: "string", length: 16)]
68
	protected $postal = '';
69
70
	#[ORM\Column(name: "city", type: "string", length: 200)]
71
	protected $city = '';
72
73
	#[ORM\Column(name: "state", type: "string", length: 200)]
74
	protected $state = '';
75
76
	#[ORM\Column(name: "langid", type: "string", length: 5, nullable: true)]
77
	protected $langid = '';
78
79
	#[ORM\Column(name: "countryid", type: "string", length: 2, nullable: true)]
80
	protected $countryid = '';
81
82
	#[ORM\Column(name: "telephone", type: "string", length: 32)]
83
	protected $telephone = '';
84
85
	#[ORM\Column(name: "telefax", type: "string", length: 32)]
86
	protected $telefax = '';
87
88
	#[ORM\Column(name: "email", type: "string", length: 255)]
89
	protected $email = '';
90
91
	#[ORM\Column(name: "website", type: "string", length: 255)]
92
	protected $website = '';
93
94
	#[ORM\Column(name: "longitude", type: "decimal", precision: 8, scale: 6, nullable: true)]
95
	protected $longitude;
96
97
	#[ORM\Column(name: "latitude", type: "decimal", precision: 8, scale: 6, nullable: true)]
98
	protected $latitude;
99
100
	#[ORM\Column(name: "birthday", type: "date", nullable: true)]
101
	protected $birthday;
102
103
	#[ORM\Column(name: "vdate", type: "date", nullable: true)]
104
	protected $vdate;
105
106
	#[ORM\Column(name: "ctime", type: "datetime")]
107
	protected $ctime;
108
109
	#[ORM\Column(name: "mtime", type: "datetime")]
110
	protected $mtime;
111
112
	#[ORM\Column(type: 'string', length: 180, unique: true)]
113
	protected $editor = '';
114
115
116
	public function getUserIdentifier() : string
117
	{
118
		return $this->code ?? '';
0 ignored issues
show
Bug Best Practice introduced by
The property code does not exist on Aimeos\ShopBundle\Entity\User. Did you maybe forget to declare it?
Loading history...
119
	}
120
121
122
	/**
123
	 * @inheritDoc
124
	 */
125
	public function getId() : ?string
126
	{
127
		return $this->id;
128
	}
129
130
131
	/**
132
	 * @inheritDoc
133
	 */
134
	public function getUsername() : ?string
135
	{
136
		return $this->username;
137
	}
138
139
140
	/**
141
	 * @inheritDoc
142
	 */
143
	public function getSalt() : ?string
144
	{
145
		return 'mshop';
146
	}
147
148
149
	/**
150
	 * @inheritDoc
151
	 */
152
	public function getPassword() : ?string
153
	{
154
		return $this->password;
155
	}
156
157
158
	/**
159
	 * @inheritDoc
160
	 */
161
    public function setPassword(string $password): self
162
    {
163
        $this->password = $password;
164
        return $this;
165
    }
166
167
168
	/**
169
	 * @inheritDoc
170
	 */
171
	public function getRoles() : array
172
	{
173
		return array( 'ROLE_USER' );
174
	}
175
176
177
	/**
178
	 * @inheritDoc
179
	 */
180
	public function eraseCredentials()
181
	{
182
	}
183
184
185
	public function __serialize()
186
	{
187
		return serialize( array(
188
			$this->id,
189
			$this->username,
190
			$this->password,
191
		) );
192
	}
193
194
195
	public function __unserialize( $serialized )
196
	{
197
		list (
198
			$this->id,
199
			$this->username,
200
			$this->password,
201
		) = unserialize( $serialized );
202
	}
203
}
204