FindPasswordRequestByIdsQueryObject   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createQuery() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SixtyEightPublishers\User\ForgotPassword\Query;
6
7
use SixtyEightPublishers\DoctrineQueryObjects\AbstractQueryObject;
8
use SixtyEightPublishers\User\ForgotPassword\Entity\PasswordRequestInterface;
9
use SixtyEightPublishers\DoctrineQueryObjects\QueryFactory\QueryFactoryInterface;
10
11
final class FindPasswordRequestByIdsQueryObject extends AbstractQueryObject
12
{
13
	/** @var mixed  */
14
	private $userId;
15
16
	/** @var mixed  */
17
	private $passwordRequestId;
18
19
	/**
20
	 * @param mixed $userId
21
	 * @param mixed $passwordRequestId
22
	 */
23
	public function __construct($userId, $passwordRequestId)
24
	{
25
		$this->userId = $userId;
26
		$this->passwordRequestId = $passwordRequestId;
27
	}
28
29
	/**
30
	 * {@inheritdoc}
31
	 */
32
	public function createQuery(QueryFactoryInterface $queryFactory)
33
	{
34
		return $queryFactory->createQueryBuilder()
35
			->select('pr')
36
			->from(PasswordRequestInterface::class, 'pr')
37
			->where('pr.user = :uid')
38
			->andWhere('pr.id = :rid')
39
			->andWhere('pr.status = :status')
40
			->setParameter('uid', $this->userId)
41
			->setParameter('rid', $this->passwordRequestId)
42
			->setParameter('status', PasswordRequestInterface::STATUS_CREATED);
43
	}
44
}
45