GetUserByEmailQueryObject   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createQuery() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SixtyEightPublishers\User\ForgotPassword\Query;
6
7
use SixtyEightPublishers\User\Common\UserMapping;
8
use SixtyEightPublishers\DoctrineQueryObjects\AbstractQueryObject;
9
use SixtyEightPublishers\User\ForgotPassword\Entity\UserInterface;
10
use SixtyEightPublishers\DoctrineQueryObjects\QueryFactory\QueryFactoryInterface;
11
12
final class GetUserByEmailQueryObject extends AbstractQueryObject
13
{
14
	/** @var string  */
15
	private $email;
16
17
	/** @var \SixtyEightPublishers\User\Common\UserMapping  */
18
	private $mapping;
19
20
	/**
21
	 * @param string                                        $email
22
	 * @param \SixtyEightPublishers\User\Common\UserMapping $mapping
23
	 */
24
	public function __construct(string $email, UserMapping $mapping)
25
	{
26
		$this->email = $email;
27
		$this->mapping = $mapping;
28
	}
29
30
	/**
31
	 * {@inheritdoc}
32
	 */
33
	public function createQuery(QueryFactoryInterface $queryFactory)
34
	{
35
		return $queryFactory->createQueryBuilder()
36
			->select('u')
37
			->from(UserInterface::class, 'u')
38
			->where('u.' . $this->mapping[UserMapping::FILED_EMAIL] . ' = :email')
39
			->setParameter('email', $this->email);
40
	}
41
}
42