1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the U2F Security bundle. |
5
|
|
|
* |
6
|
|
|
* (c) Michael Barbey <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Mbarbey\U2fSecurityBundle\Model\User; |
13
|
|
|
|
14
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
15
|
|
|
use Doctrine\Common\Collections\Collection; |
16
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
17
|
|
|
use Mbarbey\U2fSecurityBundle\Model\Key\U2fKeyInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* U2F user entity base |
21
|
|
|
* |
22
|
|
|
* When you edit your own user entity, you can either extends this class or implement the U2fUserInterface. |
23
|
|
|
* |
24
|
|
|
* @author Michael Barbey <[email protected]> |
25
|
|
|
*/ |
26
|
|
|
abstract class U2fUser implements U2fUserInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @ORM\OneToMany(targetEntity="App\Entity\Key", mappedBy="user", orphanRemoval=true) |
30
|
|
|
*/ |
31
|
|
|
protected $u2fKeys; |
32
|
|
|
|
33
|
37 |
|
public function __construct() |
34
|
|
|
{ |
35
|
37 |
|
$this->u2fKeys = new ArrayCollection(); |
36
|
37 |
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return Collection|U2fKeyInterface[] |
40
|
|
|
*/ |
41
|
1 |
|
public function getU2fKeys() |
42
|
|
|
{ |
43
|
1 |
|
return $this->u2fKeys; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param U2fKeyInterface $u2fKey |
48
|
|
|
* @return self |
49
|
|
|
*/ |
50
|
1 |
|
public function addU2fKey(U2fKeyInterface $u2fKey) |
51
|
|
|
{ |
52
|
1 |
|
if (!$this->u2fKeys->contains($u2fKey)) { |
53
|
1 |
|
$this->u2fKeys[] = $u2fKey; |
54
|
1 |
|
$u2fKey->setUser($this); |
55
|
|
|
} |
56
|
|
|
|
57
|
1 |
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param U2fKeyInterface $u2fKey |
62
|
|
|
* @return self |
63
|
|
|
*/ |
64
|
1 |
|
public function removeU2fKey(U2fKeyInterface $u2fKey) |
65
|
|
|
{ |
66
|
1 |
|
if ($this->u2fKeys->contains($u2fKey)) { |
67
|
1 |
|
$this->u2fKeys->removeElement($u2fKey); |
68
|
|
|
// set the owning side to null (unless already changed) |
69
|
1 |
|
if ($u2fKey->getUser() === $this) { |
70
|
1 |
|
$u2fKey->setUser(null); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
74
|
1 |
|
return $this; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths